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

Table Sort #10

Open
zakuArbor opened this issue Jul 26, 2022 · 2 comments
Open

Table Sort #10

zakuArbor opened this issue Jul 26, 2022 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@zakuArbor
Copy link
Owner

Either override default sort or send all data but only render x number of items. Issue is that sort only sorts data in the current pagination.

@zakuArbor
Copy link
Owner Author

zakuArbor commented Jul 31, 2022

The rows prop is where you provide us with a list of all the rows that you want to render in the table. The only hard requirement is that this is an array of objects, and that each object has a unique id field available on it.
[{ id: string, disabled: bool, isSelected: bool, isExpanded: bool }]

To have sort done by the front end, do not splice the rows. Instead give all the rows except modify in CoursesTable based on the pagination whether the row is disabled or not

Source: https://react.carbondesignsystem.com/?path=/story/components-datatable-basic--default

@zakuArbor
Copy link
Owner Author

zakuArbor commented Jul 31, 2022

Tried setting disabled to true and realized it probably means something else. Probably need to send the entire data still but figure out how to not display them but have sort recognize the data. I want to avoid overriding sorting algorithm to manually display the rows we want.

Edit: I think it's best to focus on filter ability which is onChangeText or whatever you setRows with the rows to display. It's been a while but I recalled having a variable holding the entire rows separately and just change displayed data using setRows. Sorting was a bit difficult but I had to get source code of DataTable which is very annoying and modifying it.

To do sorting, perhaps have an onClickHandler where instead of calling a custom nor its own sort, just re-render dataTable with the rows sorted in the way we want with all the rows in hand.

@zakuArbor zakuArbor added the enhancement New feature or request label Jul 31, 2022
@zakuArbor zakuArbor modified the milestones: ver 0.1.0, ver 0.2.0 Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant