Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Commit 7cf6528

Browse files
adlairdjonshaffer
authored andcommitted
Add sortType docs and demo (#35)
* Added checkbox to turn on/off multi column sort in Sorting demo * Added sortType option to README.md and defaults.js * Updated wording of comments
1 parent cce09fb commit 7cf6528

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ The data table can be created with the following `options`:
148148
- `rowHeight`: Row height in pixels, necessary if using lazy rendering (default: `30`)
149149
- `scrollbarV`: Enable vertical scrollbars (default: `true`)
150150
- `selectable`: Whether users can select items (default: `false`)
151+
- `sortType`: Whether to allow sorting by multiple columns or only 1 (`multiple` or `single`) (default: `multiple`)
151152

152153
## Contributing
153154

demos/sort.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
</head>
4343
<body ng-app="app" ng-controller="HomeController">
4444

45+
<label><input type="checkbox" ng-model="multiple" ng-change="updateSortType()" /> Multi column sorting</label>
4546

4647
<dtable options="options" rows="data" class="material" on-sort="onColumnSort(sorts)"></dtable>
4748

@@ -62,12 +63,18 @@
6263
})
6364
}
6465

66+
$scope.updateSortType = () => {
67+
$scope.options.sortType = $scope.multiple === true ? 'multiple' : 'single';
68+
}
69+
70+
$scope.multiple = true;
71+
6572
$scope.options = {
6673
rowHeight: 50,
6774
headerHeight: 50,
6875
footerHeight: false,
6976
scrollbarV: false,
70-
sortType: 'multiple', // available options: ['single', 'multiple']
77+
sortType: 'multiple',
7178
// onSort: $scope.onColumnSort,
7279
columns: [{
7380
name: "Name",

src/defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export const TableDefaults = {
6363
// if you can reorder columns
6464
reorderable: true,
6565

66+
// sorting by single or multiple columns
67+
sortType: 'multiple',
68+
6669
internal: {
6770
offsetX: 0,
6871
offsetY: 0,

0 commit comments

Comments
 (0)