[英]Show rich:popupPanel on click of rich:tab
一頁包含豐富的面部標簽面板,並具有4個標簽。 在選項卡之一中,我有文本框和保存按鈕。 不保存數據如果我移到另一個選項卡,它將顯示彈出窗口,顯示未保存的數據並阻止導航。
我嘗試使用rich:tabPanel的其他Java腳本加載屬性調用彈出窗口,但沒有達到目的。
這是代碼
<rich:tabPanel onclick="#{rich:component('confirmation')}.show();return false" switchType="ajax" id="wizardTab" itemChangeListener="#{bean.tabChange}" activeItem="#{bean.activeTab}">
<rich:tab id="tab1"
// tab1
</rich:tab>
<rich:tab id="tab2"
</rich:tab>
<rich:tab id="tab3"
</rich:tab>
<rich:tab id="tab4"
<h:inputText id="test"
styleClass="span2" maxlength="25"
value="#{bean.rowForChange.code}">
<f:ajax event="blur" execute="@this"/>
</h:inputText>
<h:commandButton value="Update" styleClass="button"
style="width:160px"
action="#{bean.updtae}">
<a4j:ajax execute="paramValue"
render="table simeditPnl" />
</h:commandButton>
</rich:tab>
</rich:tabPanel>
<rich:popupPanel render="#{jCRDataRefreshManagement.updateStatus}" id="confirmation" modal="false" autosized="true" resizeable="false">
<f:facet name="header">Confirmation</f:facet>
<h:panelGrid>
<h:panelGrid columns="2">
<h:graphicImage value="/alert.png" />
<h:outputText value="You have unsaved changes. Are you sure?" style="FONT-SIZE: large;" />
</h:panelGrid>
<h:panelGroup>
<input type="button" value="OK"
onclick="#{rich:component('confirmation')}.hide();submit();return false" />
<input type="button" value="Cancel"
onclick="#{rich:component('confirmation')}.hide();return false" />
</h:panelGroup>
</h:panelGrid>
</rich:popupPanel>
如果選項卡4上文本框上有任何未保存的數據並試圖單擊任何其他選項卡,則該數據應留在選項卡4中並顯示如上的確認彈出窗口。
通過此實現,每當我單擊選項卡時,我的彈出窗口都會打開。
請指出我正在做的錯誤或針對以上情況提出建議。 任何幫助
如果不想切換選項卡,請使用onbeforeitemchange
並單擊false,而不是單擊。
如果要延遲切換,請使用以下命令:
saveTabs = function(event) {
oldItem = event.rf.data.oldItem,
newItem = event.rf.data.newItem;
}
<rich:tabPanel id="tabPanel" onbeforeitemchange="saveTabs(event); return false;" >
而當您決定切換使用時:
RichFaces.component("form:tabPanel").__itemsSwitcher().exec(oldItem, newItem);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.