2015-07-21 44 views
1

我認爲這是Tab容器中的一個錯誤...這是一個Tab容器中的錯誤嗎?

使用Java或服務器端打開新選項卡JavaScript新建選項卡包含設置爲指向另一個XPage的iframe的面板時的JavaScript createTab方法在同一個數據庫中總是會導致XPage在加載大約五個或六個選項卡後重新加載(在Chrome中,IE確實相同,但需要更多選項卡......)

如果選項卡包含指向另一個的iframe保存XPage的數據庫工作正常。

SSJS代碼是: getComponent("djTabContainer1").createTab({title:"New tab"});;

的Java代碼

public static boolean createTab(UIDojoTabContainer tabContainer) { 

    try { 
     if (tabContainer == null) { 
      tabContainer = (UIDojoTabContainer) Utils.findComponent("TabContainer"); 
      if (tabContainer == null) { 
       return false; 
      } 
     } 

     String tabTitle = null; 
     String url = null; 
     String unid = null; 
     UIDojoTabPane newTab = null; 

     // get default number from current project preferences 
     tabTitle = "My Tabpage"; 
     url = Utils.GetXpageURL("tabpage.xsp"); 

     // create a new Tab 
     newTab = new UIDojoTabPane(); 
     newTab.setTitle(tabTitle); 
     newTab.setTabUniqueKey(new Random().toString()); 

     newTab.setClosable(true); 
     newTab.setId("TabContainer_" + unid); 
     newTab.setStyleClass("myTabContainer"); 

     Utils.WriteToConsole("setting style class on " + newTab.getTitle()); 
     // newTab.setStyle("height:auto;width:auto; overflow-y: auto;border: 0px;"); 

     // create new Panel 
     UIPanelEx newPanel = new UIPanelEx(); 
     newPanel.setId("IFrame" + unid); 
     newPanel.setStyleClass("iframeClass"); 
     // make an iFrame of this panel with our URL as src 
     newPanel.setTagName("iframe"); 
     Attr property = new Attr(); 
     property.setName("src"); 
     property.setValue(url); 
     newPanel.addAttr(property); 

     // add Panel to our new Tab 
     newTab.getChildren().add(newPanel); 

     // add the new tab to our tab container 
     tabContainer.getChildren().add(newTab); 
     tabContainer.setSelectedTab(unid); 
     return true; 
    } catch (Exception ex) { 
     Utils.WriteToConsole("Unable to add a new Tab Page to the Tab Container (com.tlcc.Main.createTab)", ex); 
     return false; 
    } 

} 

是在iframe的src屬性引用XPage上是非常基本的...

<?xml version="1.0" encoding="UTF-8"?> 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"> 
<xp:button 
    value="Label" 
    id="button1"> 
</xp:button> 
<xp:inputText id="inputText1"></xp:inputText></xp:view> 

當XPage中重新加載它沒有更多的標籤(除了在開始時在XPage中創建的第一個選項卡)並且沒有響應。

Howard

回答

0

因此,要完成這個......對於視圖狀態設置= nostate允許更多的標籤,但隨後不留組件在內存中。所以,它只適用於只讀XPage,但不適用於XPage上的文檔處於編輯模式。在持久性選項卡的Xsp屬性中磁盤上設置最大頁數將允許更多帶有XPage的iframe的選項卡,但仍會在某個時間點崩潰。

網絡是,不要使用多個內部框架,從相同的NSF拉入XPages ...

4

它可能是服務器頁面持久性/組件樹限制問題。如果使用默認的服務器頁面持久性,則服務器僅在內存中存儲4個頁面(每個用戶)。

當您在加載另一個XPage的頁面上創建新選項卡時,服務器正在填充服務器頁面持久性隊列,當您點擊第5個選項卡時,當前頁面不再是服務器頁面持久性的一部分(組件樹不再在內存中)導致重新加載當前頁面。

您可以增加存儲的頁數(也可以移動磁盤持久性而不是內存持久性)。您也可以將viewState設置爲在您加載到iframe中的XPage中「取消」(至少要測試我的理論)。

Toby Samples blog post on state和這個答案就類似狀態問題:https://stackoverflow.com/a/31431917/785061

+0

每個幾乎肯定是在正確的軌道在這裏。 「當前XPage」的定義也可能是一個因素。當你最初加載父XPage時,這將是當前頁面。但是如果你在iFrame中加載另一個XPage,我認爲iFrame中的XPage被認爲是當前頁面,在這種情況下,父頁面的持久化方法將變爲在磁盤上,就好像你已經從父項頁面添加到iFrame頁面。 –

+0

這似乎在我的測試用例數據庫中。明天將嘗試「真正」的應用程序。謝謝Per !!!! – Howard