angular-ui/ui-grid

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

Open

#5,663 opened on 2016年9月7日

GitHub で見る
 (1 comment) (1 reaction) (0 assignees)JavaScript (5,395 stars) (2,496 forks)batch import
good first issue

説明

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.

コントリビューターガイド