通过setColumnDefs设置新的列定义不再起作用 [英] Set new column definition by setColumnDefs doesn't work anymore

查看:160
本文介绍了通过setColumnDefs设置新的列定义不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过使用网格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设置新的列定义不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆