Set dojox.grid.datagrid header column width dynamically

后端 未结 1 868
孤独总比滥情好
孤独总比滥情好 2020-12-21 14:54
  • I have a declarative dojox.grid.datagrid with initial header column width. And i have a textbox. my need is
  • In UI, if user enters any value to textbox, tha

相关标签:
1条回答
  • 2020-12-21 15:19

    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.

    0 讨论(0)
提交回复
热议问题