상속: IClientSerializable
예제 #1
0
        /// <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;
        }