PDA

View Full Version : Create a button column in a grid panel by extending Ext.grid.Column



forumuser1080
25 Mar 2011, 9:25 AM
I am trying to create a button in one of my rows in a grid panel.

I was thinking I could just specify the column in the column model like this:


colModel = {
...
,
Ext.ux.grid.ButtonColumn({
button : {
xtype: 'button',
text: 'test button',
handler: function() {
// handle button click
}
}
})
}


An then just extend the Column object to render the button that you provide via the 'button' property.


Ext.ux.grid.ButtonColumn = Ext.extend(Ext.grid.Column, {
constructor: function(config) {
Ext.ux.grid.ButtonColumn.superclass.constructor.call(this, config);

// Need to somehow render the button for this column
this.renderer = ???
}
});



Is this possible? Anyone done anything like this before? I am using Ext 3.2.1 which does not have the ActionColumn otherwise I might just use that, although its an icon not really a button.

Thanks