PDA

View Full Version : [CLOSED] Removing extra columns from the menu of a gridpanel



arjunrvasisht
Jan 13, 2015, 3:57 AM
Hi,
I have gridpanel, based on some conditions i will be showing/hiding some of the columns. But the hidden columns can be unhide anytime using the menu option. Please find the attached image below. Let me know what property to be set to remove the hidden columns from the menu list.

http://forums.ext.net/attachment.php?attachmentid=18801&stc=1

Dimitris
Jan 13, 2015, 5:14 AM
Hello,

Inside your gridpanel define a listener to customize the context menu:



<Listeners>
<ViewReady Handler="customMenu(this);" />
</Listeners>


The handler function accesses the context menu and hides the first and second column checkbox options:



<script type="text/javascript">
var customMenu = function(obj) {
var menu = obj.getView().headerCt.getMenu();
menu.items.get('columnItem').menu.items.get(0).hid e();
menu.items.get('columnItem').menu.items.get(1).hid e();
}
</script>


Hope it helps.