SetSortColumns() публичный Метод

Accepts an array of objects in the form [ { columnId: [string], sortAsc: [boolean] }, ... ]. When called, this will apply a sort glyph in either ascending or descending form to the header of each column specified in the array. Note that this does not actually sort the column. It only adds the sort glyph to the header
public SetSortColumns ( List cols ) : void
cols List
Результат void
Пример #1
0
        protected virtual void SetInitialSortOrder()
        {
            var sortBy = GetDefaultSortBy();

            if (view != null)
            {
                view.SortBy = sortBy.ToArray();
            }

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

            slickGrid.SetSortColumns(mapped);
        }
Пример #2
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);
        }