Set dojox.grid.datagrid header column width dynamically

早过忘川 提交于 2019-11-29 15:53:28

There is a method called setCellWidth() (you can read about it in the API Documentation) which you can use to change the width of the cells.

The only step you then need to complete is to update the column (so that the changes become visible). This step can be completed with cell.view.update();.

Be aware: updating the complete grid with grid.update() or grid.sizeChange() is not enough because it will only update the column headers. (That's something I noticed.)

So in your forEach loop you would do something like:

grid.setCellWidth(idx, "200px");
cell.view.update();

I also made a working JSFiddle which you can view here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!