-
Notifications
You must be signed in to change notification settings - Fork 31
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
getSelectedModels
sometimes includes undefined values
#3
Comments
Using fullCollection when available sounds reasonable. A PR with tests would be great :) |
I always get I am using the following versions:
I am using Chrome version 35.0.1916.153. Thanks! |
I changed my dependencies to the latest commit of I have the same issue. If I click a select all box, I get a result array that includes only the models for the rows being displayed on the current page. |
It seems like some of select-all's functionality (getSelectedModels and select-all events for example) depends on the use of the collection's fullCollection property. Unless I am mistaken, this property is really only useful when the collection is in client mode. In server mode, the entire collection is rarely present. Am I missing something? |
@ErikEvenson That's correct. |
I'm having this same issue using backgrid-filter. After filtering a pageable collection, the getSelectedModels() method returns undefined values because the fullCollection property is not complete. In turn, this is causing select-all to malfunction. Is there any solution or workaround to this problem? |
The original issue has already been fixed, so this must require a different steps to reproduce. Can you show me how to reproduce this issue? |
It's fixed for pageable, but the fundamental issue is:
The easiest solution may be to just listen to |
So select-all is causing problems for the vanilla Backbone.Collection is that what you are saying? This may require the ability to distinguish a real remove and or reset from pagination events. |
The original fix didn't address the issue with reset events. I've been running with the following patch. It works for me, but I don't know what unintended consequences it may have (I dont use pagination... yet).
|
I don't have a unit test to isolate the issue, yet.
But, when using this extension along with backbone pageabe, 'getSelectedModels' includes undefined values for previously selected models after pagination. I suspect it is because it's gathering selected models from
this.collection
:https://github.com/wyuenho/backgrid-select-all/blob/master/backgrid-select-all.js#L236
It should probably be
this.collection.fullCollection
when the collection is pageable.I can work around the issue by removing the
undefined
values from the array.Another approach would be to use
this.collection.fullCollection
if it exists.Would you welcome a PR for either of these approaches?
The text was updated successfully, but these errors were encountered: