angular-ui/ui-grid

gridSaveState

Open

#5.250 geöffnet am 23. März 2016

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (2.496 Forks)batch import
help wanted

Repository-Metriken

Stars
 (5.395 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

If there are filters applied to columns the result of gridApi.saveState.save() strips the condition out of the objects in the column.filters array. When attempting to reapply the filters, it doesn't work because of this missing property.

To reproduce:

  1. Generate a grid
  2. Apply a filter to a column (e.g. gridApi.grid.columns[2].filters = [{term: 'foo', condition: 8}]
  3. Execute gridApi.grid.refresh();
  4. Save the results of saveState.save() into var (e.g. var bar = gridApi.saveState.save())
  5. Examine bar.columns[2].filters === [{term: 'foo'}] i.e condition property is missing.

In Plnkr http://plnkr.co/edit/jHHMdZSez3Vxui4VWbP4?p=preview:

  1. Enter search term in input field
  2. Examine $scope.gridApi.grid.columns[4].filters after $scope.search has been executed
  3. Examine the filter for the colummn in $scope.state.column after $scope.saveState() has been executed
  4. Note that condition property is missing from the filter applied to the column in $scope.state

Contributor Guide