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

Idea for Sorting #706

Open
patorjk opened this issue Jun 19, 2019 · 1 comment
Open

Idea for Sorting #706

patorjk opened this issue Jun 19, 2019 · 1 comment

Comments

@patorjk
Copy link
Collaborator

patorjk commented Jun 19, 2019

Creating from comment in #605.

In the current API, each column options object has a "sortDirection" property. This can lead to ambiguity if multiple columns have this field set. I would propose to change the API to work similarly to the jQuery Datatables plugin. Instead of this being handled at the column level, it would be handled at the table level. A new property "order" could be added to the table options. The property would be an array of objects. Example:

order: [ {name: 'office', direction: 'asc'}, {name: 'age', direction: 'desc'} ],

Additionally, the property could be setup to just take in an object:

order: {name: 'office', direction: 'asc'},

In this case, it would know there is only 1 field for sorting.

The reason to allow an array is because sometimes having a secondary or tertiary sort is useful. You can see an example of this on the table at datatables.net: https://datatables.net/ - first click the "Office" field, then hold SHIFT and click the "Age" field. The table sorts by the Office field, and then entries with the same office get sorted by Age.

Most of the time you only want to sort by 1 field, but in certain cases it is quiet useful to have the ability to add a secondary sort. The downsides are that visually, if you were to just look at the arrows, you wouldn't known the primary sort field. This could possibly be mitigated by lightening the color of successive sort arrows. Or just allowing the user to infer, as the datatables.net plugin does. The other downside is that this is a power-user feature - most people don't know to click SHIFT to add a secondary sort. But some users really like the ability to do this.

@benjamin-joham
Copy link

Is this still ongoing? Or is there already a fix/workaround in the latest version?

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