Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Access to ListGrid header menu?

    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.

    #2
    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.

    Comment


      #3
      Just a FYI the list of API's not yet in SmartGWT are documented and as API's are added, they are removed from the list. The list of remaining API's are reducing quickly and the plan is to have them all in by beta2 or beta3.

      Comment


        #4
        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

        Working...
        X