示例#1
0
文件: ListView.cs 项目: wanaxe/Study
        public ListView(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator)
            : base(viewContext, initializer)
        {
            UrlGenerator = urlGenerator;

            Pageable = new PageableSettings();

            Selectable = new ListViewSelectionSettings();

            Editable = new ListViewEditingSettings <T>();

            settingsSerializer = new ListViewSettingsSerializer <T>(this);

            DataSource = new DataSource()
            {
                Type             = DataSourceType.Ajax,
                ServerAggregates = true,
                ServerFiltering  = true,
                ServerGrouping   = true,
                ServerPaging     = true,
                ServerSorting    = true
            };

            DataSource.ModelType(typeof(T));
        }
示例#2
0
        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));
        }