Mui-datatables: Sorting not working properly with real api

Created on 14 Oct 2018  路  7Comments  路  Source: gregnb/mui-datatables

Expected Behavior

Hello, I expect configure the sort mechanism in onTableChange callback (with sort action) for real api.

Current Behavior

  • Trigger api call from onTableChange callback (when come with sort action).
  • Update data variable via this.setState({data}) after get the new data from API.
  • The table lose order direction (and symbol).
  • When I click again to same column, it try again with same direction (not opposite).

Steps to Reproduce

I create reproduce demo on codesandbox -> https://codesandbox.io/s/pmypxp4l8x

  1. Go to the codesandbox link
  2. Open console
  3. Try to use sorting via browser on any column
  4. You can see issue from console logs and selected column behavior

PS:

Now I'm also having the same issue filter feature. I guess somehow the table state is lost.

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | 3.1.2 |
| MUI-datatables | 2.0.0-beta-32 |
| React | 16.5.2 |
| browser | Google Chrome OSX 69.0.3497.100 (Official Build) (64-bit) |
| etc | - |

bug

Most helpful comment

This is indeed a bug. Thanks for reporting I'll try to get to it when I have some time but I'll slap a tag on here incase anyone can pitch in

All 7 comments

This is indeed a bug. Thanks for reporting I'll try to get to it when I have some time but I'll slap a tag on here incase anyone can pitch in

Should have this resolved shortly. Pushed up a PR to fix this issue

Published in the latest

Yes it works, thank you @gregnb 馃憤

Hello I am getting same issue when I used customBodyRender tag in other columns in latest version 2.0.0-beta-37

You can check
https://codesandbox.io/s/j215o4k5pw

Hello,

I'm seeing this same issue on 2.11.0. Believe it is related to #729

There might still be some issues with serverside sorting, but if you are sorting serverside, then you'll need to update the sortDirection in the column options manually, as this will control the arrow direction. Does that help, or is it something else?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

demoreno picture demoreno  路  4Comments

aramkoukia picture aramkoukia  路  3Comments

chapmanjacobd picture chapmanjacobd  路  4Comments

Andy1408 picture Andy1408  路  4Comments

mhmmdakbr picture mhmmdakbr  路  4Comments