Skip to content

getSelectedModels sometimes includes undefined values #3

@twalker

Description

@twalker

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.

return _.compact(result);

Another approach would be to use this.collection.fullCollection if it exists.

Would you welcome a PR for either of these approaches?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions