通过setColumnDefs设置新的列定义不再起作用

编程入门 行业动态 更新时间:2024-10-13 06:15:00
本文介绍了通过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设置新的列定义不再起作用

本文发布于:2023-11-23 01:15:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619584.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定义   setColumnDefs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!