how to show/ hide column in a extjs 3 grid panel

前端 未结 6 1181
温柔的废话
温柔的废话 2020-12-10 04:26

I have a grid panel i need to show / hide columns in a grid panel depending on the value of a checkbox. If the checkbox is checked i need to display column in the grid and i

6条回答
  •  旧时难觅i
    2020-12-10 05:30

    The answers above I think are pretty good. But let me give you a advice.

    1) In ExtJS 4.x it is recommended to use Ext.ComponentQuery`s methods instead of Ext.getCmp()

    2) To hide/show columns of the grid you can use following code

    Ext.ComponentQuery.query('grid gridcolumn[dataIndex^="service"]')[0].hide()
    

    or to show

    Ext.ComponentQuery.query('grid gridcolumn[dataIndex^="service"]')[0].show()
    

    It should resolve hiding/showing any column in a grid.

    Here grid is your grid , it maybe id or xtype etc.

提交回复
热议问题