Example #1
0
        /// <summary>
        /// Base Constructor
        /// </summary>
        /// <param name="gridName"></param>
        /// <param name="toolbarOptions"></param>
        /// <param name="commandOptions"></param>
        /// <param name="historicalRow"></param>
        /// <param name="showPager"></param>
        public GridData(string gridName, GridToolBarOptions toolbarOptions, GridCommandButtonOptions commandOptions, bool historicalRow = true, bool showPager = true, string editController = "Generic")
        {
            ButtonOptions  = commandOptions;
            HistoricalRow  = historicalRow;
            ShowPager      = showPager;
            EditController = editController;
            ToolBarOptions = toolbarOptions;
            Name           = gridName;

            AddRemoveCustomAddNew();

            Buttons = new List <GridButton>()
            {
                new GridButton(GridButtonTypes.Add),
                new GridButton(GridButtonTypes.Update),
                new GridButton(GridButtonTypes.Delete),
                new GridButton(GridButtonTypes.Cancel),
                new GridButton(GridButtonTypes.Edit)
            };

            PageSizes = DevExpressGridExtensions.DefaultPageSizeItems;

            RowInitializeEvent = (s, e) =>
            {
                DefaultNewRowInitializeFields(e);
            };
        }
Example #2
0
        public GridData(string gridName, string controller, string action, bool initializeCallBack = false, object callBackRoute = null, string key = "Id", string displayColumnName = "Name", IDictionary <GridRouteTypes, string> routes = null, bool historicalRow = false, GridToolBarOptions toolbarOptions = null, GridCommandButtonOptions commandButtonOptions = null, bool showPager = true, string editController = "Generic") : this(gridName, toolbarOptions ?? new GridToolBarOptions(false), commandButtonOptions ?? new GridCommandButtonOptions(true, displayAddButtonInGridHeader : false), historicalRow : historicalRow, showPager : showPager, editController : editController)
        {
            Key = key;
            DisplayColumnName = displayColumnName.Translate();
            Name       = gridName;
            Controller = controller;
            Action     = action;

            if (routes != null && routes.Count > 0)
            {
                foreach (var kv in routes)
                {
                    Routes.Add(new GridRoute(kv.Key, new { Controller = Controller, Action = kv.Value }));
                }
            }

            if (initializeCallBack)
            {
                CallBackRoute = callBackRoute;
            }
        }