Announcement

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

    Tab pane not displayed -- need force redraw?

    This is my scenario:

    1) Create canvas A and add a tab set with 2 tabs
    ---a) Add a list grid to the 2nd tab
    2) Create canvas B and add a tab set with 2 tabs
    ---a) Add the same list grid in step 1a to save loading times because it's mostly the same code and multiple canvases use it
    3) Navigate to canvas A. Click the 2nd tab. Everything displays as should.
    4) Navigate to canvas B. Click the 2nd tab. Everything displays as should.
    5) Navigate back to the 2nd tab of canvas A (using an event that calls selectTab). The tab pane is blank.

    If I click 1st tab of canvas A then click the 2nd tab. Everything displays as should though. So I think it has something to do with the tab pane needing to be drawn.

    Some things I've tried are calling Tab.setPane(); TabSet.updateTab(); tab pane draw() when !isDrawn(); and redraw() on the canvas, tab pane, and tab set. Nothing seems to work.

    I can try to post my code but we're using the MVP pattern and it might take a while to post the relevant parts.

    I'm using IE7 with SmartGWT 2.3 (schedule is not permitting upgrade to 2.4 yet).

    Any tips? Thanks!

    #2
    A single component can't have two parents. If the ListGrid in question is a child of, say, a Layout component that is set as Tab.pane, then when another Tab shows the same ListGrid it's going to be deparented from it's original pane and moved to the other tab.

    You can, however, set the same component as tab.pane for two different panes, then show and hide *interior* components within the pane as needed.

    Are you aware that we strongly recommend against MVP? It simply adds additional code - no SmartGWT sample can be simplified by the introduction of MVP. As you're now seeing, it creates a burden because even a simple use case involves a lot of extra code and is hard to boil down to a test case.

    Comment


      #3
      Thanks for your reply!

      I found a workaround in the meantime though. Seemed like calling selectTab(currentTab) didn't do anything so I tried saving the current tab, calling selectTab(0), and then selectTab(currentTab). So far, it's working fine and there's no noticeable delay. I'll revisit it if we run into any problems in the future.

      Unfortunately, we didn't know about SmartGWT and MVP at the time of the decision about 9 months ago so we're stuck with it now.

      Comment


        #4
        On the tab thing - we're unclear on the hierarchy (ListGrid inside a Layout vs directly used as Tab.pane), but as far as the deparenting effect, if this is happening, in the Developer Console's "Results" tab in the band in the middle you will see Clears and Draws increment by 1 each time it happens.

        If it's happening, it may be a performance problem down the road. If its not, don't worry about it.

        About MVP: it's not too late! MVP will be an ongoing burden, and you may be able to eliminate it piecemeal.

        Comment

        Working...
        X