-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(table): Add syncable sort-by and sort-desc props #742
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
Conversation
Adds two new props to allow user to specify sorting column and direction. The new props can be made two way by adding the `.sync` modifier, and will be updated whenever sorting column or direction changes
@@ -382,12 +383,28 @@ will emit the `filtered` event, passing a single argument which is the complete | |||
items passing the filter routine. Treat this argument as read-only. | |||
|
|||
### Sorting | |||
As mentioned above in the **fields** section, you can make columns sortable. Clciking on | |||
sortable a column header will sort the column in ascending direction, while clicking | |||
on it again will switch the direction or sorting. Clicking on a non-sortable column |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed a reset by clicking on non-sortable column, because it just set sortBy to null
, but parameter sort=null|<sortDesc>
still sending to backend API.
On another tought, is may be up to Item provider func to deal with null sort target and remove it from query.
And on third thought, maybe better not expicitly to null sortBy
, but reset it to default sortBy, defined at startup. If it not defined, then to null it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although some may want to clear the sort... but you never know. The original table (from before I started working on it) cleared the sort on a non-sortable column.
Some people may want to table to display in the order sent from the server (as not having a null sort by would case b-table to sort the data which is received).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, i think that this feature should be restored at my variant of <b-table>
But it needs to be reviewed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, we can merge this branch, and i will continue to work on mine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK cool... so everything looks OK in this branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm, Ill make a final test at local Playground doc, though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK good... The docs example should show the sort key and order under the table, using the .sync
modifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I could dd a button that says 'clear sort' (which is disabled if sort-by
is null
) to the example.
Clicking on the button would set sort-by
to null
, and if sort-by
is null
then the button could be disabled. Sowing a bit more interactivity with with the table.
Adds two new props to allow user to specify sorting column and direction.
The new props can be made two way by adding the
.sync
modifier, and will be updated whenever sorting column or direction changes.These props complement (or can be used instead of) the
sort-changed
event.Includes documentation updates