protected override NWidget CreateExampleContent() { // create a view and get its grid NTableGridView view = new NTableGridView(); NTableGrid grid = view.Grid; // create persons order data source NDataSource personOrders = NDummyDataSource.CreatePersonsOrdersDataSource(); // get the min and max price. We will use it in the progress bars. object min, max; personOrders.TryGetMin("Price", out min); personOrders.TryGetMax("Price", out max); grid.AutoCreateColumn += delegate(NAutoCreateColumnEventArgs args) { if (args.FieldInfo.Name == "Price") { // create a progress bar column format for the Price field NProgressBarColumnFormat progressBarColumnFormat = new NProgressBarColumnFormat(); progressBarColumnFormat.Minimum = Convert.ToDouble(min); progressBarColumnFormat.Maximum = Convert.ToDouble(max); args.DataColumn.Format = progressBarColumnFormat; } }; grid.DataSource = NDummyDataSource.CreatePersonsOrdersDataSource(); return(view); }
protected override NWidget CreateExampleContent() { // create a view and get its grid NTableGridView view = new NTableGridView(); NTableGrid grid = view.Grid; grid.AllowEdit = true; // create persons order data source NDataSource personOrders = NDummyDataSource.CreatePersonsOrdersDataSource(); // get the min and max price. We will use it in the progress bars. object min, max; personOrders.TryGetMin("Price", out min); personOrders.TryGetMax("Price", out max); grid.AutoCreateColumn += delegate(NAutoCreateColumnEventArgs args) { if (args.FieldInfo.Name == "Price") { // create a progress bar column format for the Price field NSliderColumnEditor sliderColumnEditor = new NSliderColumnEditor(); args.DataColumn.Editor = sliderColumnEditor; args.DataColumn.WidthMode = ENColumnWidthMode.Fixed; args.DataColumn.FixedWidth = 150; } }; grid.DataSource = personOrders; return(view); }
protected override NWidget CreateExampleContent() { // create a view and get its grid NTableGridView view = new NTableGridView(); NTableGrid grid = view.Grid; // bind to sales data source NDataSource dataSource = NDummyDataSource.CreateCompanySalesDataSource(); grid.DataSource = dataSource; // create an expression filter rule that matches records for which Company is equal to Leka string companyFxName = dataSource.CreateFormulaFieldName("Company"); string expression1 = companyFxName + "==\"" + NDummyDataSource.RandomCompanyName() + "\""; grid.FilteringRules.Add(new NFilteringRule(new NFormulaRowCondition(expression1))); // create an expression filter rule that matches records for which Sales is larger than 1000 string salesFxName = dataSource.CreateFormulaFieldName("Sales"); string expression2 = salesFxName + ">1000"; grid.FilteringRules.Add(new NFilteringRule(new NFormulaRowCondition(expression2))); grid.AllowSortColumns = true; grid.AlternatingRows = true; grid.RowHeaders.Visible = true; return(view); }