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);
        }
예제 #2
0
 protected override NWidget CreateExampleContent()
 {
     m_TableView = new NTableGridView();
     m_TableView.Grid.DataSource = NDummyDataSource.CreateCompanySalesDataSource();
     m_TableView.Grid.AllowEdit  = true;
     return(m_TableView);
 }
예제 #3
0
        protected override NWidget CreateExampleContent()
        {
            m_TableView = new NTableGridView();
            m_TableView.Grid.DataSource = NDummyDataSource.CreateCompanySalesDataSource();

            // show the row headers
            m_TableView.Grid.RowHeaders.Visible = true;
            return(m_TableView);
        }
예제 #4
0
        protected override NWidget CreateExampleContent()
        {
            // create a view and get its grid
            NTableGridView view = new NTableGridView();
            NTableGrid     grid = view.Grid;

            // bind the grid to the data source
            grid.DataSource = NDummyDataSource.CreateCompanySalesDataSource();

            // create a sorting rule that sorts by the company column first
            NColumn companyColumn = grid.Columns.GetColumnByFieldName("Company");

            grid.SortingRules.Add(new NSortingRule(companyColumn, ENSortingDirection.Ascending));

            // create a sorting rule that sorts by the sales column next
            NColumn salesColumn = grid.Columns.GetColumnByFieldName("Sales");

            grid.SortingRules.Add(new NSortingRule(salesColumn, ENSortingDirection.Ascending));

            return(view);
        }
        protected override NWidget CreateExampleContent()
        {
            NTableGridView gridView = new NTableGridView();
            NTableGrid     grid     = gridView.Grid;

            // bind the grid to the data source
            grid.DataSource = NDummyDataSource.CreateCompanySalesDataSource();

            // create a grouping rule that groups by the company field value first
            // note that in order to indicate the grouping in the grouping panel, the rule must reference the respective column
            NColumn          companyColumn = grid.Columns.GetColumnByFieldName("Company");
            string           fx1           = grid.CreateFormulaFieldName("Company");
            NFormulaRowValue fxRowValue    = new NFormulaRowValue(fx1);
            NGroupingRule    groupingRule1 = new NGroupingRule(companyColumn, fxRowValue, ENSortingDirection.Ascending);

            grid.GroupingRules.Add(groupingRule1);

            // create a grouping rule that groups by sales larger than 1000 next
            // note that in order to indicate the grouping in the grouping panel, the rule must reference the respective column
            string        fx2           = grid.CreateFormulaFieldName("Sales") + ">1000";
            NColumn       salesColumn   = grid.Columns.GetColumnByFieldName("Sales");
            NGroupingRule groupingRule2 = NGroupingRule.FromFormula(salesColumn, fx2);

            groupingRule2.CreateGroupRowCellsDelegate += delegate(NGroupingRuleCreateGroupRowCellsArgs arg)
            {
                bool   groupValue = (bool)((NVariant)arg.GroupRow.GroupValue);
                string text       = groupValue? "Sales greater than 1000" : "Sales less than or equal to 1000";
                return(new NGroupRowCell[] { new NGroupRowCell(text) });
            };
            grid.GroupingRules.Add(groupingRule2);

            // alter some view preferences
            grid.AllowSortColumns   = true;
            grid.AlternatingRows    = true;
            grid.RowHeaders.Visible = true;

            return(gridView);
        }