Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid group compulsory sorting #31

Open
fawadahmad opened this issue Jan 8, 2019 · 1 comment
Open

Avoid group compulsory sorting #31

fawadahmad opened this issue Jan 8, 2019 · 1 comment

Comments

@fawadahmad
Copy link

What problem does this feature solve?

It looks like a sorting is applied to the groups. This is not the requirement every time. I found an option in the demo to be able to change the sort order in ascending or descending but no option to disable this sorting at all.

In my case, I need to group the data and display the groups in the same order in which groups were collected from the data.

@lzhoucs
Copy link
Owner

lzhoucs commented Jan 10, 2019

group level sort is mandatory by default, because it makes sense in most cases by making sure non-contiguous rows are put into the same groups. For example: given the following data:

group1, item1,
group3, item2,
group2, item3,
group1, item4,
group2, item5

After group sort, the table renders the following rows:

group1 row,
  item1 row,
  item4 row,
group 2 row,
  item 3 row,
  item 5 row,
...

Without group sort, item1 and item4 won't be put together. If this is not what you want, there's still ways to change. Simply specify a custom-sort prop which overrides the default sort function which sort by group first then sort by items within group second. Items within group sort can also be disabled by:

  • add disable-initial-sort prop
  • add sortable: false to each header entry in the headers prop

By doing all above, you can have a complete no sort table whose items order are entirely driven by the data coming in on both group and item level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants