Skip to content

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

Merged
merged 9 commits into from
Jul 28, 2017

Conversation

tmorehouse
Copy link
Member

@tmorehouse tmorehouse commented Jul 25, 2017

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

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
@tmorehouse tmorehouse added this to the v0.19.0 milestone Jul 25, 2017
@tmorehouse tmorehouse requested a review from mosinve July 25, 2017 22:14
@tmorehouse tmorehouse requested review from pi0 and alexsasharegan July 27, 2017 02:52
@@ -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
Copy link
Member

@mosinve mosinve Jul 28, 2017

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.

Copy link
Member Author

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).

Copy link
Member

@mosinve mosinve Jul 28, 2017

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.

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

@tmorehouse tmorehouse Jul 28, 2017

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.

@tmorehouse tmorehouse merged commit c8ad5a3 into master Jul 28, 2017
@tmorehouse tmorehouse deleted the tmorehouse-table-sort branch July 28, 2017 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants