angular-ui/ui-grid

saveState.save and saveState.restore selects incorrect items in the grid if a filter is present

Open

#5663 aperta il 7 set 2016

Vedi su GitHub
 (1 commento) (1 reazione) (0 assegnatari)JavaScript (2496 fork)batch import
good first issue

Metriche repository

Star
 (5395 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

If you have say, a grid with 10 items in it and apply a filter that results in rows 6 - 10 being shown, select all of them and then invoke saveState.save then saveState.restore row 6 - 10 are not selected. If you then remove the filter you will find that rows 1-5 are selected.

Looking at what saveState.save produces it seems that the stored selections are row indexes for the filtered selection: "selection":[{"identity":false,"row":0},{"identity":false,"row":1},... But are reapplied to the grid as a whole.

This can be demonstrated using the grid here http://ui-grid.info/docs/#/tutorial/208_save_state Type B in the 'Company' filter and select the top 3 rows. Hit the Save button. Remove the selections and the Company filter. Hit the Restore button.

The filter is applied but nothing appears to be selected. Remove the filter and you will find the top 3 rows of the grid selected.

Guida contributor