Forum /
Ext JS Community Forums 4.x /
Ext: Q&A /
Unanswered: I Can't render tems Action Column
Unanswered: I Can't render tems Action Column
Hi
Please can you tell me what's wrong in this code :
I'm trying to extend Action Column with two Items.
Try please to replace the code in code editor in this documentation url to see the problem :
Ext.create('Ext.data.Store', {
storeId:'employeeStore',
fields:['firstname', 'lastname', 'seniority', 'dep', 'hired'],
data:[
{firstname:"Michael", lastname:"Scott"},
{firstname:"Dwight", lastname:"Schrute"},
{firstname:"Jim", lastname:"Halpert"},
{firstname:"Kevin", lastname:"Malone"},
{firstname:"Angela", lastname:"Martin"}
]
});
Ext.define('Ext.grid.column.Custom', {
extend: 'Ext.grid.column.Action',
alias: ['widget.customcolumn'],
width: 50,
items: [{
xtype : 'button',
icon: 'extjs/examples/shared/icons/fam/cog_edit.png', // Use a URL in the icon config
tooltip: 'Edit',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
alert("Edit " + rec.get('firstname'));
}
}, {
xtype : 'button',
icon: 'extjs/examples/restful/images/delete.png',
tooltip: 'Delete',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
alert("Terminate " + rec.get('firstname'));
}
}]
});
Ext.create('Ext.grid.Panel', {
title: 'Action Column Demo',
store: Ext.data.StoreManager.lookup('employeeStore'),
columns: [
{text: 'First Name', dataIndex:'firstname'},
{text: 'Last Name', dataIndex:'lastname'},
{
xtype:'customcolumn',
}
],
width: 250,
renderTo: Ext.getBody()
});
Sencha User
Take a look at the constructor for Action column:
http://docs.sencha.com/ext-js/4-1/so...od-constructor
It seems that it doesn't read the items from this , it just checks the config, so adding them to the prototype via Ext.define won't work. I can't think of a good reason why it does this, it should probably be changed.
You're going to have to override the constructor and pass a suitable config to the original constructor to get it to work.
Sencha - Support Team
I just found the same thing. BTW, width is also not read, but text is.
Should we file this as a bug or as an enhancement request to have width, items, etc. read from 'this' in the definition?
Same drama here.. does anybody solve it?
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us