繁体   English   中英

单击rich:tab时显示rich:popupPanel

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM