angular-ui/ui-grid

Dynamically toggle between gridOptions

Open

#6.838 geöffnet am 31. Aug. 2018

Auf GitHub ansehen
 (1 Kommentar) (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

I am in much need of help to dynamically change the gridOptions particularly the styles, as the column definitions do change. Here is a plnkr showing my attempt.

http://plnkr.co/edit/bH9TWQwJ0on6B8JLu3EX?p=preview

The column definitions change according to the currently set gridoptions but styles like rowHeight and showHeader do not change.

getLargeRowHeightGridOptions has rowHeight of 50 and showHeader as false, getSmallRow... has rowHeight of 15 and should show header. However, when you click "Toggle GridOptions" the only thing that changes are the column definitions.

You can see in my plnkr in the method "toggleGridOptions" I am trying to use vm.gridApi.core.refresh(). I also tried using vm.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS); and vm.gridApi.core.notifyDataChange(uiGridConstants.dataChange.ALL)

None of these worked, do you have any suggestions on say, in my plnkr how to really toggle between gridoptions? How to refresh gridApi properly so that the all the gridoptions get toggled not just the columns? Thanks!

I have tried to look up terms like "refresh gridoptions dynamically" in these links. https://github.com/angular-ui/ui-grid/issues/5242 https://stackoverflow.com/questions/26634063/how-to-use-refresh-method-in-ui-grid https://stackoverflow.com/questions/34666859/ui-grid-does-not-refresh-the-dynamic-style-after-modify-the-modal-data

Contributor Guide