-
-
Notifications
You must be signed in to change notification settings - Fork 119
Sorting
Ghislain B edited this page Nov 17, 2017
·
23 revisions
Sorting on the client side is really easy, you simply need to enable sortable
(when not provided, it is considered as disabled) on each columns you want to sort and it will sort as a type string. Oh but wait, sorting as string might not always be ideal, what if we want to sort by number or by date? The answer is to simply pass a type
as shown below.
To use any of them, you need to import FieldType
from Angular-Slickgrid
as shown below. Also please note that FieldType.string
is the default and you don't necessarily need to define it, though you could if you wish to see it in your column definition.
import { FieldType } from 'angular-slickgrid';
export class GridBasicComponent implements OnInit {
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
ngOnInit(): void {
this.columnDefinitions = [
{ id: 'title', name: 'Title', field: 'title', sortable: true },
{ id: 'duration', name: 'Duration (days)', field: 'duration', sortable: true, type: FieldType.number },
{ id: '%', name: '% Complete', field: 'percentComplete', sortable: true, type: FieldType.float},
{ id: 'start', name: 'Start', field: 'start', sortable: true, type: FieldType.dateIso },
{ id: 'finish', name: 'Finish', field: 'finish', sortable: true, type: FieldType.dateIso },
{ id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven', sortable: true }
];
}
}
Contents
- Angular-Slickgrid Wiki
- Installation
- Styling
- Interfaces/Models
- Testing Patterns
- Column Functionalities
- Global Grid Options
- Localization
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Composite Editor
- Context Menu
- Custom Tooltip
- Add/Delete/Update or Highlight item
- Dynamically Change Row CSS Classes
- Excel Copy Buffer
- Export to Excel
- Export to File (CSV/Txt)
- Grid State & Presets
- Grouping & Aggregators
- Row Detail
- SlickGrid Controls
- SlickGrid Plugins
- Pinning (frozen) of Columns/Rows
- Tree Data Grid
- SlickGrid & DataView objects
- Addons (controls/plugins)
- Backend Services