Announcement

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

    TabSet.addTab(tab, index) doesn't force tab to draw

    Hello

    TabSet.addTab(tab, index) doesn't force tab to draw.
    Replacing with TabSet.addTab(tab) works OK.


    SmartClient Version: v10.0p_2015-06-17/LGPL Development Only (built 2015-06-17)

    IE 11

    #2
    What causes a tab's pane to draw is becoming the selected tab.

    Neither variant of addTab() will cause a tab to draw, and neither should, unless the newly added tab is becoming the selected tab.

    Comment


      #3
      Sorry, I forgot to say I do selectTab(t) after addTab() and it doesn't work. New tab becomes selected but not drawn. I have to select another tab and then this new one again to draw it.

      Code:
      mainTabSet.addTab(t, currentTabIndex + 1);
      mainTabSet.selectTab(t);
      Last edited by Oleg; 18 Jun 2015, 00:54.

      Comment


        #4
        We're not seeing an issue with a quick check of making these two calls. Can you show complete code for a scenario where this doesn't work?

        Comment


          #5
          Hi Isomorphic

          Please find example attached. I know code style is awful but it seems nothing illegal nonetheless.
          Attached Files

          Comment


            #6
            Your code mixes GWT and SmartGWT components and that's not supported.

            If you change your code to use regular SmartGWT buttons, does that fix your issue?

            Comment


              #7
              Hi Isomorphic

              The same issue for SmartGWT buttons is in place.
              Attached Files

              Comment


                #8
                Ok, we see the issue now - your async call to Tab.setPane() is happening after the Tab has been added to the TabSet, and Tab.setPane() is not actually a runtime setting, despite it being available as one.

                We'll look at either making it a runtime setting, or removing the setter.

                You can fix your sample by calling TabSet.setTabPane() instead:

                Code:
                mainTabSet.setTabPane(MyTab.this.getID(), getLayout(button));

                Comment


                  #9
                  Hi Isomorphic,

                  I'm using myTab.setPane() in order to lazy-load the contents:
                  Code:
                  windowTabSet.addTabSelectedHandler(new TabSelectedHandler() {
                  	@Override
                  	public void onTabSelected(TabSelectedEvent event) {
                  		switch (event.getTab().getID()) {
                  		case MASTERDATA_TAB:
                  			break;
                  		case ALLOWED_TAB:
                  			if (addEditCampaignAllowed == null) {
                  				addEditCampaignAllowed = new AssignCampaignAllowed(AddEditCampaign.this);
                  				allowedTab.setPane(addEditCampaignAllowed);
                  			}
                  			break;
                  		case LEADTYPES_TAB:
                  			if (addEditCampaignLeadtype == null) {
                  				addEditCampaignLeadtype = new AssignCampaignLeadtype(AddEditCampaign.this);
                  				leadtypeTab.setPane(addEditCampaignLeadtype);
                  			}
                  			break;
                  		}
                  	}
                  });
                  This is also recommended by you in the QuickStartGuide:
                  Originally posted by QuickStartGuide, PDF page 95
                  Defer creation and drawing of components until they are shown to the end user.
                  Creating and drawing all of your components on the onModuleLoad() function will lead to poor start time for larger applications. Instead, create and draw only the components required for the initial view.
                  Defer creation of components by waiting until the user navigates to the view. For example, to create the components which appear in a tab only when the user selects the tab, use the TabSelected event in conjunction with Tab.setPane().
                  This means that many projects will use this pattern, so please make the setting a runtime setting.

                  Best regards
                  Blama

                  Comment


                    #10
                    Yes, sorry, our last reply was badly phrased.

                    setPane() *is* a runtime setting - however, it doesn't refresh at runtime in the case where setPane() is called on a tab *which is already selected*, because it's tab-selection that causes the pane to be updated.

                    We'll address that.

                    Comment


                      #11
                      This turned out to be a simple, SGWT-only logic bug, and was indeed specific to the indexed version of addTab() - it's been fixed back to 4.0 for builds dated June 26.

                      Comment


                        #12
                        Hi Isomorphic

                        I see the issue is fixed now with SmartClient Version: v10.0p_2015-06-28/LGPL Development Only (built 2015-06-28).

                        Thank you very much!

                        Comment

                        Working...
                        X