Esempio n. 1
0
        public void GridConfig_Defaults()
        {
            GridConfig actual = new GridConfig();

            Assert.Empty(actual.Columns);
            Assert.Empty(actual.Name);
        }
Esempio n. 2
0
        public static IHtmlGrid <T> Configure <T>(this IHtmlGrid <T> html, GridConfig grid)
        {
            List <IGridColumn <T> > columns = html.Grid.Columns.ToList();

            html.Grid.Columns.Clear();

            foreach (GridColumnConfig config in grid.Columns)
            {
                if (columns.Find(column => String.Equals(column.Name, config.Name, StringComparison.OrdinalIgnoreCase)) is IGridColumn <T> column)
                {
                    columns.Remove(column);
                    html.Grid.Columns.Add(column);
                    column.IsHidden = config.Hidden;
                }
            }

            foreach (IGridColumn <T> column in columns)
            {
                html.Grid.Columns.Add(column);
            }

            return(html);
        }