Announcement

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

    Using SectionHeaderClick - Handle Header Clicks

    I am using a section stack as a navigation region, and there are a couple of sections that do not really have sub-sections. For these, I would like for the section headers to be used as links (such as Home and Logout)

    I browsed the Javadocs and thought maybe I could use sectionHeaderClick(), but I couldn't figure out how to properly use that. I found a couple examples in the forums for it, but they applied to the Javascript version and not GWT version.

    If I have a couple sections in the stack and want to handle an event when those sections are clicked, how can I do it? Do I use sectionHeaderClick(), and if so, can anyone provide a simple example in GWT?

    For example, when someone clicks the header that reads "Home", instead of opening and displaying a listgrid (what I use for links), I would rather it simply do

    History.newItem("home");

    But if possible, I would prefer it to only do this on certain headers, not all of them. Or, at the very least, be able to perform a check to see if it is one of two section headers, and if so fire the history item, if not then use default expand / collapse behavior.

    Any tips?

    #2
    It seems like a TreeGrid would more directly implement what you want. You can style the rows that are meant as section headers differently from the other rows.

    Comment


      #3
      Hello,

      I have SectionStack with several buttons: some are collapsible, some are not.
      I use smartGWT 2.0, and tried to addSectionHeaderClickHandler, but it isn't invoked onclick for non-collapsible buttons.

      Is there a solution for smartGWT2.0?

      Code:
      SectionStack navigationContainer = new SectionStack();
              final SectionStackSection button = new SectionStackSection("1");
              button.setCanCollapse(false);
      button.setID("noncollapse");
              navigationContainer.addSection(button);
      
              final SectionStackSection button2 = new SectionStackSection("2");
              button2.setCanCollapse(true);
      button2.setID("collapse");
      
              navigationContainer.addSection(button2);
      
      SectionHeaderClickHandler handler = new SectionHeaderClickHandler() {
                          @Override
                          public void onSectionHeaderClick(SectionHeaderClickEvent event) {
                              if(event.getSection().getID().equals("noncollapse")){
                                  SC.say("hello");
                              }
                          }
                      };
      
      
              navigationContainer.addSectionHeaderClickHandler(clickHandler);
      thank you
      Last edited by la123; 11 Jul 2010, 04:54.

      Comment

      Working...
      X