Announcement

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

    Only send requests for the selected tab when first launch the TabSet

    SmartClient_SNAPSHOT_v91d_2013-10-08

    We have a TabSet, and each tab is a PortalLayout componenent contains multiple portlets.

    We found that when launch the following TabSet as an example, all the 'src' link will be processed, then when the tab is changed, the 'src' link in that tab will be reprocessed again. This means that the first time through all tabs are processed but only one is shown. Is there a way to not trigger the processing the tabs that are not being shown? The tabs will be processed if and only if when the user select that tab? As a result, this can save some processing time.

    Thanks,

    Code:
    isc.TabSet.create({
        top:40, width:400, height:250,
        tabs:[
            { title:"Tab1",
               pane:isc.PortalLayout.create({ 
                     portlets: [{
                         isc.Portlet.create({
                             title: "Portlet1",
                             src: ".......request link 1........"
                         }),
                         isc.Portlet.create({
                             title: "Portlet2",
                             src: ".......request link 2........"
                         })
                     }]
              } )
            },
            { title:"Tab2",
               pane:isc.PortalLayout.create({ 
                     portlets: [{
                         isc.Portlet.create({
                             title: "Portlet3",
                             src: ".......request link 3........"
                         }),
                         isc.Portlet.create({
                             title: "Portlet4",
                             src: ".......request link 4........"
                         })
                     }]
              } )
            }
        ]
    });

    #2
    You could alter your code so that you don't provide the panes at initialization. Then, add a tabSelected() override and, if the passed "pane" param is null, create your PortalLayout and pass it to updateTab() - something like this:

    Code:
    tabSelected : function (tabNum, pane, ID, tab, name) {
        if (!pane) {
            // create an appropriate PortalLayout (check name param or tab.name)
            pane = isc.PortalLayout.create(props);
            this.updateTab(tabNum, pane);
        }
    }

    Comment


      #3
      In reality, we read json data and generate the whole tab set on fly.

      We have following TabSet definition:
      Code:
      isc.TabSet.create({
          ID: mTabSet
      });
      From reading json data, we create each pane which is a PortalLayout component:
      Code:
       isc.PortalLayout.create({
          ID: mTab1
      });
      For each tab, we generate all the portlets and add each portlet to the pane,
      suppose we have following portlet definition
      Code:
      var lPortlet1 = isc.Portlet.create({
           title: "portlet1",
           src: "..... link 1 ......"
      })
      then we add portlet to the pane
      Code:
      mTab1.addPortlet(lPortlet1, aColIndex, aRowIndex)
      Once all the portlets are added, for each tab call following to add each tab to the TabSet
      Code:
      mTab1.addTab({
         pane: mTab1
      })
      In this case, can I still use the way you suggested before?

      Thanks

      Comment

      Working...
      X