cloudflarearchive / backgrid-select-all

Select-all extension for Backgrid.js
http://backgridjs.com
MIT License
12 stars 31 forks source link

getSelectedModels broken for pageable collections #14

Open ZECTBynmo opened 9 years ago

ZECTBynmo commented 9 years ago

I'm using a server-side paginated PageableCollection, and the select-all extension. When I click select all, the checkboxes do stay selected as I navigate between pages, but getSelectedModels returns the wrong thing.

For example, in a 500 element collection with 25 item page size, this is the output after checking select-all on the first page:

window.research.requestResultsTable.grid.getSelectedModels()
[child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child]

Notice that the models included are only the ones on the first page.

Now, if I navigate to page 2, and try it again, the output is even worse:

window.research.requestResultsTable.grid.getSelectedModels()
[undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child, child]

Notice that we now have 50 items in the output, and the first half of them are undefined.

ghost commented 7 years ago

I think I am experiencing a similar issue....