angular-ui/ui-grid

Dynamically toggle between gridOptions

Open

#6,838 创建于 2018年8月31日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)JavaScript (2,496 fork)batch import
help wanted

仓库指标

Star
 (5,395 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南