RegisterPlugin() public method

Registers a plugin
public RegisterPlugin ( object plugin ) : void
plugin object An instance of plugin object to register.
return void
Exemplo n.º 1
0
        public static void MakeOrderable(SlickGrid grid, Action <int[], int> handleMove)
        {
            var moveRowsPlugin = new SlickRowMoveManager(new SlickRowMoveManagerOptions
            {
                CancelEditOnDrag = true
            });

            moveRowsPlugin.OnBeforeMoveRows.Subscribe((e, data) =>
            {
                for (var i = 0; i < data.rows.length; i++)
                {
                    if (data.rows[i] == data.insertBefore || data.rows[i] == data.insertBefore - 1)
                    {
                        e.StopPropagation();
                        return(false);
                    }
                }
                return(true);
            });

            moveRowsPlugin.OnMoveRows.Subscribe((e, data) =>
            {
                int[] rows       = data.rows;
                int insertBefore = data.insertBefore;
                handleMove(rows, insertBefore);
                try { grid.SetSelectedRows(new int[0]); }
                catch { }
            });

            grid.RegisterPlugin(moveRowsPlugin);
        }
Exemplo n.º 2
0
        protected virtual SlickGrid CreateSlickGrid()
        {
            List <SlickColumn> slickColumns;

            if (this.IsAsyncWidget())
            {
                slickColumns = new List <SlickColumn>();
            }
            else
            {
                slickColumns = PostProcessColumns(GetColumns());
            }

            var slickOptions = GetSlickOptions();
            var grid         = new SlickGrid(slickContainer, data: view.As <List <dynamic> >(), columns: slickColumns, options: slickOptions);

            grid.RegisterPlugin(new SlickAutoTooltips(new SlickAutoTooltipsOptions
            {
                EnableForHeaderCells = true
            }));

            this.slickGrid = grid;
            this.Rows      = this.slickGrid.As <GridRows <TItem> >();

            if (!IsAsyncWidget())
            {
                SetInitialSortOrder();
            }

            return(grid);
        }
Exemplo n.º 3
0
        protected virtual SlickGrid CreateSlickGrid()
        {
            List <SlickColumn> slickColumns;

            if (this.IsAsyncWidget())
            {
                slickColumns = new List <SlickColumn>();
            }
            else
            {
                slickColumns = PostProcessColumns(GetColumns());
            }

            var     slickOptions = GetSlickOptions();
            var     self         = this;
            dynamic viewRows     = view.Rows;

            viewRows.getItemMetadata = new Func <int, dynamic>(delegate(int index)
            {
                var item = self.view.Rows[index];
                return(self.GetItemMetadata(item, index));
            });

            var grid = new SlickGrid(slickContainer, data: viewRows, columns: slickColumns, options: slickOptions);

            grid.RegisterPlugin(new SlickAutoTooltips(new SlickAutoTooltipsOptions
            {
                EnableForHeaderCells = true
            }));

            this.slickGrid = grid;

            if (!IsAsyncWidget())
            {
                SetInitialSortOrder();
            }

            return(grid);
        }
Exemplo n.º 4
0
        protected virtual SlickGrid CreateSlickGrid()
        {
            var     slickColumns = PostProcessColumns(GetColumns());
            var     slickOptions = GetSlickOptions();
            var     self         = this;
            dynamic viewRows     = view.Rows;

            viewRows.getItemMetadata = new Func <int, dynamic>(delegate(int index)
            {
                var item = self.view.Rows[index];

                return(self.GetItemMetadata(item, index));
            });

            var grid = new SlickGrid(slickContainer, data: viewRows, columns: slickColumns, options: slickOptions);

            grid.RegisterPlugin(new SlickAutoTooltips(new SlickAutoTooltipsOptions
            {
                EnableForHeaderCells = true
            }));

            grid.SetSortColumns(GetDefaultSortBy().Map <SlickColumnSort>(s =>
            {
                var x = new SlickColumnSort();
                if (s != null && s.ToLower().EndsWith(" DESC"))
                {
                    x.ColumnId = s.Substr(0, s.Length - 5);
                    x.SortAsc  = false;
                }
                else
                {
                    x.ColumnId = s;
                    x.SortAsc  = true;
                }
                return(x);
            }));

            return(grid);
        }