-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
getSelections Method fails to maintain all selected rows #7448
Comments
This is not a bug, check this page: Use maintainMetaData option to maintain the meta data(selected rows and hidden rows) on change page and search. |
I believe I have found the issue. If you place a data formatter on the column the getSelections will work inconsistently within the context of the current page for the given table. If you go to the example noted in my posting for the getSelections, add the following properties to the table: Update the table: Then go to the "script" section and add: function isChecked(value, row) { When the getSelections button is clicked, you will note that it does NOT contain the data from page 2 for "id = 14", even though it is selected. If you navigate to the second page to verify that the item for "id = 14" is checked, press the getSelections button again, and it now appears to have both items. Now, go back to the first page and check ID 6 and click the getSelections button. Seems fine. Navigate to the second page and unselect ID 14 and click the getSelections button. Seems fine. Return to the first page and ID 6 is no longer checked. Click the getSelections button again and it contains both ID 4 and 6. Premise for the bug was... I loaded a list of IDs which belong to an entity, say a Dealership. The IDs represent the cars which are currently on the lot. A table is then filled with a property on the Dealership called Cars, but Cars represent all cars the dealership owns. So the data formatter is used to set the state based on if the Car's ID is in the list of IDs (similar to the function above) to show which Car is currently on the lot for the Dealership. The user has received notice that Car ID 32 is now on the lot and wishes to update the table by checking the box. The user also receives notices that another Car has arrived at the lot as well, ID 54. So the user navigates say to page 3 (25 per page), checks that box. The user clicks a "Save" button. The action for the save simply goes to the table and calls the getSelections as this should have a list of all the data rows which have a "checked" state. But that state appears to be volatile and not being properly maintained. (As if the bug is in the maintain meta data functionality). I hope this helps better explain the issue, or heck, I might not be approaching the solution properly given the example just above. Please advise. Thanks. |
Bootstraptable version(s) affected
1.23.2
Description
When calling the "getSelections" method no items are returned when table is paged or filtered (it only returns what is on the first page).
Worse, when removing the filter, it loses all selected rows except those on the first page (if there are no rows selected on the first page, all selected rows are lost)
Example(s)
https://examples.bootstrap-table.com/#methods/get-selections.html
Simply use the example setup for method call:
Steps
Note: The checked Item ID 4 is no longer checked - so clearing the filter has cleared the selected rows!!!
Possible Solutions
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: