private static GridViewSettings GetSettingExport()
        {
            GridViewSettings settings = new GridViewSettings();

            settings.Name = "grid_acontecimientos";
            settings.CallbackRouteValues = new { Controller = "Acontecimientos", Action = "GridViewAllPartial" };
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.SettingsSearchPanel.Visible       = true;
            settings.SettingsBehavior.AllowFixedGroups = true;
            settings.SettingsBehavior.AllowDragDrop    = true;
            settings.SettingsBehavior.AllowSort        = true;

            settings.SettingsCookies.StoreFiltering          = true;
            settings.SettingsCookies.StoreGroupingAndSorting = true;
            settings.SettingsCookies.StorePaging             = true;
            settings.SettingsCookies.Enabled = true;
            settings.CustomJSProperties      = (s, e) =>
            {
                MVCxGridView gridView = (MVCxGridView)s;
                e.Properties["cpClientLayout"] = gridView.SaveClientLayout();
            };

            settings.CommandColumn.Visible        = true;
            settings.Settings.UseFixedTableLayout = true;
            settings.CommandColumn.Width          = 50;

            settings.CommandColumn.ShowClearFilterButton = true;
            //CheckBox en cada fila y checkbox general
            settings.CommandColumn.ShowSelectCheckbox    = true;
            settings.CommandColumn.SelectAllCheckboxMode = GridViewSelectAllCheckBoxMode.Page;
            settings.CommandColumn.HeaderStyle.BackColor = System.Drawing.Color.Orange;

            //settings.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control;
            settings.SettingsResizing.ColumnResizeMode = ColumnResizeMode.Control;

            settings.Settings.ShowGroupPanel           = true;
            settings.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;
            settings.Settings.VerticalScrollableHeight = 300;

            settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;
            settings.SettingsPager.FirstPageButton.Visible      = true;
            settings.SettingsPager.LastPageButton.Visible       = true;
            settings.SettingsPager.PageSizeItemSettings.Visible = true;
            settings.SettingsPager.PageSizeItemSettings.Items   = new string[] { "10", "20", "50" };

            settings.KeyFieldName = "Id";
            settings.Columns.Add("Id");
            settings.Columns.Add("Fecha Acont.");
            settings.Columns.Add("Descripcion");
            settings.Columns.Add("TipoAcontecimiento");
            settings.Columns.Add("Fecha Apertura ");
            settings.Columns.Add("Fecha Ocurrencia ");
            settings.Columns.Add("Fecha Implementacion ");
            settings.Columns.Add("Estado");;

            //Fila de filtros
            settings.Settings.ShowFilterRow = true;
            //Icono del menu del filtrado
            settings.Settings.ShowFilterRowMenu = false;

            //Setear por defecto la condicion de filtrado
            //de todas las columnas a Contains
            settings.DataBound = (sender, e) =>
            {
                MVCxGridView gv = sender as MVCxGridView;
                gv.Visible = (gv.VisibleRowCount > 0);

                foreach (GridViewColumn column in gv.Columns)
                {
                    var dataColumn = column as GridViewDataColumn;
                    if (dataColumn != null)
                    {
                        dataColumn.Settings.AutoFilterCondition = AutoFilterCondition.Contains;
                    }
                }
            };


            settings.PreRender = (s, e) =>
            {
                MVCxGridView grid = s as MVCxGridView;
                if (grid != null)
                {
                    grid.ExpandAll();
                }
            };

            settings.SettingsDetail.ExportMode = GridViewDetailExportMode.Expanded;
            return(settings);
        }
Beispiel #2
0
        public static GridViewSettings GetSettingExportWithoutId(IEnumerable <CRM.Business.Views.BaseViews.BaseViewString.DynObject> model, string controllerName)
        {
            GridViewSettings settings = new GridViewSettings();

            settings.Name = "grid_" + controllerName;
            settings.CallbackRouteValues = new { Controller = controllerName, Action = "GridViewAllPartial" };
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.SettingsSearchPanel.Visible       = true;
            settings.SettingsBehavior.AllowFixedGroups = true;
            settings.SettingsBehavior.AllowDragDrop    = true;
            settings.SettingsBehavior.AllowSort        = true;

            settings.SettingsCookies.StoreFiltering          = true;
            settings.SettingsCookies.StoreGroupingAndSorting = true;
            settings.SettingsCookies.StorePaging             = true;
            settings.SettingsCookies.Enabled = true;
            settings.CustomJSProperties      = (s, e) =>
            {
                MVCxGridView gridView = (MVCxGridView)s;
                e.Properties["cpClientLayout"] = gridView.SaveClientLayout();
            };

            settings.CommandColumn.Visible        = true;
            settings.Settings.UseFixedTableLayout = true;
            settings.CommandColumn.Width          = 50;

            settings.CommandColumn.ShowClearFilterButton = true;
            //CheckBox en cada fila y checkbox general
            settings.CommandColumn.ShowSelectCheckbox    = true;
            settings.CommandColumn.SelectAllCheckboxMode = GridViewSelectAllCheckBoxMode.Page;
            settings.CommandColumn.HeaderStyle.BackColor = System.Drawing.Color.Orange;

            settings.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control;

            settings.Settings.ShowGroupPanel           = true;
            settings.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;
            settings.Settings.VerticalScrollableHeight = 300;

            settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;
            settings.SettingsPager.FirstPageButton.Visible      = true;
            settings.SettingsPager.LastPageButton.Visible       = true;
            settings.SettingsPager.PageSizeItemSettings.Visible = true;
            settings.SettingsPager.PageSizeItemSettings.Items   = new string[] { "10", "20", "50" };

            AddColumnsSettingViewData(settings.Columns, model);
            //AddColumnsSettingViewData(settings.Columns, model, null);

            settings.Settings.ShowFilterRow     = true;
            settings.Settings.ShowFilterRowMenu = false;

            settings.DataBound = (sender, e) =>
            {
                MVCxGridView gv = sender as MVCxGridView;
                gv.Visible = (gv.VisibleRowCount > 0);

                foreach (GridViewColumn column in gv.Columns)
                {
                    var dataColumn = column as GridViewDataColumn;
                    if (dataColumn != null)
                    {
                        dataColumn.Settings.AutoFilterCondition = AutoFilterCondition.Contains;
                    }
                }
            };

            settings.PreRender = (s, e) =>
            {
                MVCxGridView grid = s as MVCxGridView;
                if (grid != null)
                {
                    grid.ExpandAll();
                }
            };

            settings.SettingsDetail.ExportMode = GridViewDetailExportMode.Expanded;
            return(settings);
        }