Is there any way to access the ListGrid header menu that by default has the sort, grouping and show/hide menuitems? I'd like to be able to insert my own MenuItems.
Announcement
Collapse
No announcement yet.
X
-
Hi Tom,
You need to be able to override or call getHeaderContextMenuItems - not there in SmartGWT yet but coming in a nightly build.Last edited by Isomorphic; 2 Dec 2008, 17:52.
-
I've added the protected method ListGrid#getHeaderContextMenuItems to build 12-02-2008.
To customize the header context menu of any column, override this method and return the appropriate MenuItem's. Here's some sample code :
Code:final ListGrid countryGrid = new ListGrid() { protected MenuItem[] getHeaderContextMenuItems(final Integer fieldNum) { final MenuItem[] items = super.getHeaderContextMenuItems(fieldNum); MenuItem customItem = new MenuItem("Hello + " + fieldNum); customItem.addClickHandler(new ClickHandler() { public void onClick(MenuItemClickEvent event) { SC.say("Hello Column : " + fieldNum); } }); MenuItem[] newItems = new MenuItem[items.length + 1]; for (int i = 0; i < items.length; i++) { MenuItem item = items[i]; newItems[i] = item; } newItems[items.length] = customItem; return newItems; } };
Comment
Comment