angular-ui/ui-grid

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

クローズ

#5,663 opened on 2016/09/07

 (1 件のコメント) (1 件のリアクション) (0 人の担当者)JavaScript (2,496 件のフォーク)batch import
good first issue

Repository metrics

Stars
 (5,395 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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.

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