PDA

View Full Version : Action columns in grid column header menu



WendyLG
4 Oct 2012, 5:34 AM
We have a grid with 2 action columns created :


return Ext.create("Ext.grid.column.Action", {
dataIndex: 'index',
text: col.title,
width: 'auto',
icon: 'resources/images/default/icon/viewAttachment.gif',
align: 'center',
tooltip: 'View attachment',
sortable: false,
getClass: me._getAttachmentColumnCss,
handler: me._viewAttachment
});


but the column menu header just lists the column as "Actions", it doesn't use the text.
How are we supposed to fix this?

vietits
4 Oct 2012, 5:41 AM
Try to use menuText instead of text:


return Ext.create("Ext.grid.column.Action", {
dataIndex: 'index',
// text: col.title,
menuText: col.title,
width: 'auto',
icon: 'resources/images/default/icon/viewAttachment.gif',
align: 'center',
tooltip: 'View attachment',
sortable: false,
getClass: me._getAttachmentColumnCss,
handler: me._viewAttachment
});

WendyLG
4 Oct 2012, 5:46 AM
thank you, so many config items that they seem to hide.

skirtle
4 Oct 2012, 5:48 AM
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.column.Action-cfg-menuText

The docs are a little misleading as menuText takes precedence over text. For a normal column that doesn't matter as the menuText defaults to null but for an Action column it defaults to Actions.

You could either set both text and menuText to the same value of just null out the menuText.

Getting lost in config options is easily done but the way to find things like this is to look at the code. The menu text of Actions must be coming from somewhere and if you just open the code to Action column it is pretty obvious where it's coming from.