示例#1
0
 public static DevExpress.Web.Mvc.TreeListSettings CreateExportTreeListSettings(TreeListExportDemoOptions options)
 {
     if (exportTreeListSettings == null)
     {
         exportTreeListSettings = CreateTreeListSettings();
     }
     exportTreeListSettings.SettingsExport.PrintSettings.AutoWidth       = options.EnableAutoWidth;
     exportTreeListSettings.SettingsExport.PrintSettings.ExpandAllNodes  = options.ExpandAllNodes;
     exportTreeListSettings.SettingsExport.PrintSettings.ShowTreeButtons = options.ShowTreeButtons;
     return(exportTreeListSettings);
 }
示例#2
0
        static DevExpress.Web.Mvc.TreeListSettings CreateTreeListSettings()
        {
            DevExpress.Web.Mvc.TreeListSettings settings = new DevExpress.Web.Mvc.TreeListSettings();

            settings.Name = "treeList";
            settings.CallbackRouteValues = new { Controller = "TreeList", Action = "ExportPartial" };
            settings.Width = Unit.Percentage(100);
            settings.AutoGenerateColumns = false;

            settings.KeyFieldName    = "ID";
            settings.ParentFieldName = "ParentID";
            settings.RootValue       = 0;

            settings.Columns.Add("Name", "Department");
            settings.Columns.Add(
                column => {
                column.FieldName = "Budget";
                column.PropertiesEdit.DisplayFormatString = "{0:C}";
            }
                );
            settings.Columns.Add("Location");
            settings.Columns.Add("Phone1", "Phone");

            settings.Summary.Add(DevExpress.Data.SummaryItemType.Count, "Name");
            settings.Summary.Add(
                item => {
                item.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                item.FieldName     = "Budget";
                item.ShowInColumn  = "Budget";
                item.DisplayFormat = "{0:C}";
            }
                );

            settings.Settings.ShowFooter      = true;
            settings.Settings.ShowGroupFooter = true;
            settings.Settings.GridLines       = GridLines.Both;
            settings.SettingsBehavior.ExpandCollapseAction        = TreeListExpandCollapseAction.NodeDblClick;
            settings.SettingsExport.Styles.Header.HorizontalAlign = HorizontalAlign.Left;

            settings.PreRender = (sender, e) => {
                ((MVCxTreeList)sender).ExpandToLevel(2);
            };

            return(settings);
        }