gregnb / gregnb/mui-datatables
How to keep default client side sorting while setting serverSide=true in options
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have a datatable where `serverSide` option is switched true for serverside pagination and works perfectly.
But while doing so I have lost all other client side features of which i need client side sorting.
Here is the onTableChange:
```
onTableChange: (action, tableState) => {
console.log(tableState)
switch(action){
case 'changePage':
this.getData(tableState.page, tableState.rowsPerPage);
break;
default:
break;
}
},
```
## Expected Behavior
I would like to keep the sorting from client side on the rendered page.
## Current Behavior
no sorting as the case is not present in my `switch` in `onTableChange`
| Tech | Version |
|--------------|---------|
| Material-UI | 4.11.0 |
| MUI-datatables | 3.3.0 |
| React | 16.12.0 |
| browser | |
| etc | |
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the `serverSide` option and the supplied `onTableChange` handler, then trace how sorting actions and `tableState` are handled. Check whether sorting can remain local for the rendered page while pagination continues through `getData`; done means page sorting works without losing server-side pagination.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100