saveState.save and saveState.restore selects incorrect items in the grid if a filter is present
#5,663 建立於 2016年9月7日
倉庫指標
- Star
- (5,395 star)
- PR 合併指標
- (30 天內沒有已合併 PR)
描述
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.