public Grid(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator, IGridHtmlBuilderFactory htmlBuilderFactory) : base(viewContext, initializer) { this.htmlBuilderFactory = htmlBuilderFactory; UrlGenerator = urlGenerator; PrefixUrlParameters = true; RowTemplate = new HtmlTemplate <T>(); DetailTemplate = new HtmlTemplate <T>(); Columns = new List <GridColumnBase <T> >(); DataKeys = new List <IDataKey>(); Pageable = new PageableSettings(); Sortable = new GridSortableSettings(); Scrollable = new GridScrollableSettings(); Navigatable = new GridNavigatableSettings(this); Filterable = new GridFilterableSettings(); ColumnMenu = new GridColumnMenuSettings(); Editable = new GridEditableSettings <T>(this) { PopUp = new Window(viewContext, Initializer) { Modal = true, Draggable = true } }; Grouping = new GridGroupableSettings(); Resizable = new GridResizableSettings(); Reorderable = new GridReorderableSettings(); TableHtmlAttributes = new RouteValueDictionary(); IsEmpty = true; Selectable = new GridSelectableSettings(); ToolBar = new GridToolBarSettings <T>(this); NoRecordsTemplate = new HtmlTemplate(); ValidationMetadata = new Dictionary <string, object>(); AutoGenerateColumns = true; DataSource = new DataSource() { Type = DataSourceType.Server, ServerAggregates = true, ServerFiltering = true, ServerGrouping = true, ServerPaging = true, ServerSorting = true }; DataSource.ModelType(typeof(T)); }
/// <summary> /// Initializes a new instance of the <see cref="Grid{T}"/> class. /// </summary> /// <param name="viewContext">The view context.</param> /// <param name="clientSideObjectWriterFactory">The client side object writer factory.</param> /// <param name="urlGenerator">The URL generator.</param> /// <param name="builderFactory">The builder factory.</param> public Grid(ViewContext viewContext, IClientSideObjectWriterFactory clientSideObjectWriterFactory, IUrlGenerator urlGenerator, ILocalizationService localizationService, IGridHtmlBuilderFactory htmlBuilderFactory) : base(viewContext, clientSideObjectWriterFactory) { this.htmlBuilderFactory = htmlBuilderFactory; UrlGenerator = urlGenerator; PrefixUrlParameters = true; RowTemplate = new HtmlTemplate <T>(); DataProcessor = new GridDataProcessor(this); Columns = new List <GridColumnBase <T> >(); DataKeys = new List <IGridDataKey <T> >(); Paging = new GridPagingSettings(this); Sorting = new GridSortSettings(this); Scrolling = new GridScrollingSettings(); KeyboardNavigation = new GridKeyboardNavigationSettings(this); ColumnContextMenu = new GridColumnContextMenuSettings(this); Filtering = new GridFilteringSettings(); Editing = new GridEditingSettings <T>(this) { PopUp = new Window(viewContext, clientSideObjectWriterFactory, new WindowHtmlBuilderFactory()) { Modal = true, Draggable = true } }; Grouping = new GridGroupingSettings(this); Resizing = new GridResizingSettings(); Reordering = new GridReorderingSettings(); TableHtmlAttributes = new RouteValueDictionary(); DataBinding = new GridDataBindingSettings(this); Footer = true; IsEmpty = true; ClientEvents = new GridClientEvents(); Selection = new GridSelectionSettings(); ScriptFileNames.AddRange(new[] { "telerik.common.js", "telerik.grid.js" }); ToolBar = new GridToolBarSettings <T>(this); Localization = new GridLocalization(localizationService, CultureInfo.CurrentUICulture); NoRecordsTemplate = new HtmlTemplate(); ValidationMetadata = new Dictionary <string, object>(); AutoGenerateColumns = true; }