PDA

View Full Version : display header grid menu on another position



copeit
27 Feb 2015, 4:54 AM
Hi everybody,

I wanna display the Menu of the Header of a grid in the Menu of a button.

Lets say we have a grid with 5 columns, 3 are hidden.



{
xtype: 'button',
text: 'Columns',
listeners: {
menushow: function(thisButton, thisMenu) {
var headerMenu= this.up("tagEditorPanel").down("tabpanel").getActiveTab().getHeaderMenu(); // <== returns thisGrid.headerCt.getMenu();
thisMenu.removeAll();
thisMenu.add(thisFirstColumn.items.items);
return true;
}
},
menu: [{ }]
}


My Idea was to have an listener on the Button and add the Menu dynamically.
Basically it shows the menu, but the menu doesnt work.

Do you know a better approach?

Thanks,

markus

yeghikyan
27 Feb 2015, 6:34 AM
So?
https://fiddle.sencha.com/fiddle/itn (https://fiddle.sencha.com/fiddle/itn)

copeit
5 Mar 2015, 12:08 AM
hi,

thanks for your answer. i think the direction is good, but not exactly what i wanna do.

look at my fiddle,
i have a "grouped" column header.
i tried to modify the fiddle but no success. do you have an idea how we can nest the menu exactly like it is in the grids menu?

also i kicked out the sort buttons, because iam interested only in the menu of the columns.

https://fiddle.sencha.com/#fiddle/j6j

thanks!

yeghikyan
5 Mar 2015, 3:31 AM
From the
this.getGrid().config.columns you can get the nested column config, there using recursion you can create appropriate nested menu for the button.