View Full Version : How to add button component in Grid Column Headers

6 Jul 2015, 10:05 PM
I have requirement to add Buttons to column headers so that client can remove the columns if he want.

The fiddle with sample code is


I tried to add items in the header of the grid as shown below, in the column header it is show [Object Object]

header: {
xtype: 'header',
text:'Delete this column'
html:'Col Heading'
dataIndex: '1yr',

Is this the correct way to do the addition of buttons in the column headers of the grid?

8 Jul 2015, 11:36 AM
Grid supports removal and addition of columns by default. Why would you want to add a button to do that?


As you hover over a column, a drop down arrow appears on the right hand side. If you click on it, a drop down will appear where you can select the "columns" option in the drop and configure your grid accordingly.

8 Jul 2015, 8:37 PM
As per the design of our screen, grid columns should not have drop down arrow next to them. The design shows delete option on the column header

9 Jul 2015, 3:57 AM
That is some interesting design. Anyway, one way would be to inject a button in the header using domQuery and handling hiding of columns in the hanler of the button. Take a look :


Although this is not recommended as the click event that triggers the handler might also trigger the click associated (namely sorting) so that will have to be disabled in order to use this approach.

9 Jul 2015, 6:06 AM
Thank you so muchh