Announcement

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

    SectionItem expand event

    Hello,
    I'm using SmartGWT 3.1p of 12/25/2012 (v8.3p_2012-12-25/PowerEdition Deployment) and like to know if there is a way to add an Handler for SectionItem to be notified when it is expanded. My use case is to lazy load a grid inside a closed section. If the user opens it, the content will be loaded.
    I've tried to add a click handler, a title click handler, a show value handler and none of them were called.
    How could I be notified when a section item is expanded?

    Regards,
    Cédric.

    #2
    While we don't have an explicit notification method, you should be able to use the click handler. Here's an example:
    Code:
        @Override
        public void onModuleLoad() {
            
            SectionItem testItem = new SectionItem();
            testItem.addClickHandler(new ClickHandler() {
                
                @Override
                public void onClick(ClickEvent event) {
                    boolean open = ((SectionItem)event.getItem()).isExpanded();
                    if (open) {
                        SC.say("Open");
                    }
                }
            });
            // Initially collapsed
            testItem.setSectionExpanded(false);
            
            TextItem item1 = new TextItem();
            item1.setName("One");
            
            TextItem item2 = new TextItem();
            item2.setName("Two");
            
            TextItem item3 = new TextItem();
            item3.setName("Three");
            
            testItem.setItemIds("Two");
            
            DynamicForm testForm = new DynamicForm();
            testForm.setItems(item1, testItem, item2, item3);
            
            testForm.draw();
            
        }

    Comment


      #3
      I added a ClickHandler as you said and it's working well.
      Don't know what I did wrong last time.
      Thanks!
      Cédric.

      Comment

      Working...
      X