carbon-design-system / carbon-components-vue

Vue implementation of the Carbon Design System
http://vue.carbondesignsystem.com
Apache License 2.0
597 stars 176 forks source link

fix: sort in datatable story. #1563

Closed davidnixon closed 6 months ago

davidnixon commented 6 months ago

Contributes to #1560

What did you do?

Added a sort function to the story and more documentation tot he story about the need for user's to implement their own search.

Why did you do it?

The current story emits the search events but does not actually sort the data. This is confusing.

Were docs updated if needed?

davidnixon commented 6 months ago

Initial state

image

After clicking on "name" header

image

After clicking on "year" heading

image

After clicking on "year" heading again (descending sort)

image

After clicking on "year" heading a 3rd time (no sort)

image

davidnixon commented 6 months ago

@hgwrtsdev what do you think of this one?

davidnixon commented 6 months ago

@felipebritor what do you think of this change?

felipebritor commented 6 months ago

.sort mutate the sorted array, which is global, but doesn't look like an issue. LGTM, @davidnixon 👍