本文整理汇总了C#中Grid.WithModel方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.WithModel方法的具体用法?C# Grid.WithModel怎么用?C# Grid.WithModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid
的用法示例。
在下文中一共展示了Grid.WithModel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public void Setup()
{
_people = new List<Person>();
_model = new GridModel<Person>();
_context = new ViewContext();
_grid = new Grid<Person>(_people, _context);
_grid.WithModel(_model);
}
示例2: Should_not_be_sortable_when_not_set
public void Should_not_be_sortable_when_not_set()
{
SetRequestContext(null, null);
var model = new GridModel<Person>();
Grid<Person> grid = new Grid<Person>(_people, _writer, _context);
grid.WithModel(model).Columns(col => col.For(x => x.Name));
grid.Render();
GridColumn<Person> column = ((IGridModel<Person>)model).Columns.FirstOrDefault();
column.ShouldNotBeNull();
column.IsSortable.ShouldBeFalse();
}
示例3: Should_store_sorted_column_options
public void Should_store_sorted_column_options()
{
SetRequestContext(null, null);
var model = new GridModel<Person>();
Grid<Person> grid = new Grid<Person>(_people, _writer, _context);
grid.WithModel(model).Columns(col => col.For(x => x.Name).Sortable(true));
grid.Render();
GridColumn<Person> column = ((IGridModel<Person>)model).Columns.FirstOrDefault();
column.ShouldNotBeNull();
column.IsSortable.ShouldBeTrue();
}
示例4: Should_create_sortable_datasource_with_sortable_columns
public void Should_create_sortable_datasource_with_sortable_columns()
{
SetRequestContext(null, null);
Grid<Person> grid = new Grid<Person>(_people, _writer, _context);
grid.WithModel(_model).Columns(col => col.For(x => x.Name).Sortable(true));
grid.Render();
grid.DataSource.ShouldBe<ComparableSortList<Person>>();
}