Announcement

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

    HeaderSpan Event Handler

    How do I implement a HeaderSpan Event Handler, which can change the current columns show/hide, or add/remove columns ?
    just like http://www.smartclient.com/#analytics
    Last edited by heavenite; 6 Sep 2010, 23:22.

    #2
    A menu for showing and hiding columns is already built into the component and enabled by default.

    Override getHeaderContextMenuItems to add more items for other functions.

    Comment


      #3
      Can not find any ClickEvent for HeaderSpan.
      We need to implement the columns show/hide change in a HeaderSpan click.
      How can we do to attach a delegate Click event to a spanheader?
      Please advice

      Comment


        #4
        There's an API getHeaderSpanContextMenuItems in the underlying SmartClient API. If you can confirm this would work for you we'll add a Smart GWT overridable method here.

        Comment


          #5
          Yes, it seems what we want ....

          Comment


            #6
            I've added ListGrid.getHeaderSpanContextMenuItems(HeaderSpan headerSpan) override point to allow header span contenxt menu customizations.

            Code:
            protected MenuItem[] getHeaderSpanContextMenuItems(HeaderSpan headerSpan)
            Sample usage :

            Code:
            final ListGrid countryGrid = new ListGrid() {
                @Override
                protected MenuItem[] getHeaderSpanContextMenuItems(final HeaderSpan headerSpan) {
                    final MenuItem[] items = super.getHeaderSpanContextMenuItems(headerSpan);
                    MenuItem customItem = new MenuItem("Custom MenuItem for " + headerSpan.getTitle());
                    customItem.addClickHandler(new ClickHandler() {
                        public void onClick(MenuItemClickEvent event) {
                            SC.say("Custom MenuItem click on " + headerSpan.getTitle());
                        }
                    });
                    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;
                }
            };
            You can pick up these changes in the next nightly build.

            Sanjiv

            Comment

            Working...
            X