public SetSortColumns ( List |
||
cols | List |
|
Результат | void |
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); }
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); }