我正在尝试通过使用网格API调用setColumnDefs来设置新的列定义。这无法正常工作。列标题的名称将不再更新!
I'm trying to set new column definitions by calling setColumnDefs using the grid API. This doesn't work as expected. The names of the column headers will not be updated anymore!
请参阅此Plunkr:版本19.1.x
See this Plunkr: Version 19.1.x
版本19.0.0是最新的工作版本。
Version 19.0.0 is latest working version.
查看此Plunkr:版本19.0.0
See this Plunkr: Version 19.0.0
对我来说,这似乎是个错误!?
For me it seems to be a bug!?
在我的项目中,我使用的是Angular 5,并且我注意到相同的行为。
In my project I'm using Angular 5 and I notice the same behaviour.
推荐答案我能够重现您的行为。以下(肮脏的)解决方法起作用:
I was able to reproduce your behaviour. The following (dirty) workaround works:
gridOptions.api.setColumnDefs([]); gridOptions.api.setColumnDefs(newColDefs);将columnDefs设置为空数组,然后传递newColDefs似乎可以实现您想要的。
Setting the columnDefs to an empty array and then passing the newColDefs seems to achieve what you are looking for.
更多推荐
通过setColumnDefs设置新的列定义不再起作用
发布评论