javascript - 底面布局

标签 javascript jsf web-applications layout primefaces

我正在使用 Primefaces 3.4.2 和 JSF2.1 我创建了一个分为一些布局单元的页面。在右侧布局单元中,我有一个 AccordionPanel 并创建了动态菜单,中间中心布局由 ui:include 组成,并且在层中加载了一个页面,当我单击链接时,会打开一个包含动态页面的对话框。 打开和关闭对话框而不在正确布局中执行任何操作后,中间中心布局不再起作用。我可以看到它,但我单击输入文本我无法在其中输入任何内容,也单击其他组件没有任何反应!有什么问题吗?有解决办法吗?

当单击菜单项打开对话框包含其他页面时,当单击树节点中心布局更改时,在对话框中打开的页面工作正常,但当关闭对话框时,中心布局按钮和输入不起作用,其他布局组件工作正常!

我的新代码:

     <p:layoutUnit id="right" position="east" size="145"  style="text-align:center;direction: ltr!important;padding: 0px!important;">
                    <h:form prependId="false">
                         <script type="text/javascript">
                            function test(id,url,title){
                                document.getElementById('h1').value=id;
                                document.getElementById('h2').value=url;
                                document.getElementById('h3').value=title;
                                salamm.jq.click();
                            } 
                        </script>
                        <h:inputHidden id="h1" value="#{adminC.nclose}" />
                        <h:inputHidden id="h2" value="#{adminC.nurl}"/>
                        <h:inputHidden id="h3" value="#{adminC.ntitle}"/>
                        <p:commandButton actionListener="#{adminC.addTab()}" id="salam" widgetVar="salamm" update=":dlgpanel" onstart="waitDialogmain.show()" style="display: none" oncomplete="waitDialogmain.hide();dlg1.show()"/>  
                        <p:accordionPanel style="text-align: center;font-family: tahoma!important" activeIndex="#{menuGen.activeIndex}">
                             <p:tab title="connections"  id="t0" rendered="#{menuGen.menuList1.length()>0}"  >

                                 <center>

                                                <h:outputText escape="false" value="#{menuGen.menuList1}"/>
                                            </center>
                                            <br/>
                                        </p:tab>
                                        <p:tab title="manage" id="t1" rendered="#{menuGen.menuList2.length()>0}" >
                                            <center>
                                                <h:outputText value="#{menuGen.menuList2}" escape="false"/>
                                            </center>
                                            <br/>
                                        </p:tab>

                            </p:accordionPanel>
                     </h:form>
                                 </p:layoutUnit>
                <p:layoutUnit id="center" style="padding: 0px!important;" position="center">
                    <p:layout widgetVar="mkh">
                        <p:layoutUnit id="middleright" position="east" size="170"  collapsible="true" style="padding: 0px;direction: ltr" >
                            <h:form prependId="false">
                             <p:tree value="#{treeC.root}"  var="node" dynamic="true" style="width: 165px;border: none;direction: rtl!important;text-align: right;font-family: tahoma;font-weight: bold" selectionMode="single" selection="#{treeC.selectedNode}">
                                 <p:ajax event="select" listener="#{treeC.onNodeSelect}" onstart="waitDialogmain.show()" oncomplete="waitDialogmain.hide()" />       
                                 <p:treeNode  >
                                     <h:outputText value="#{node}"/>
                                 </p:treeNode>

                             </p:tree>
                             <p:commandButton onclick="mkh.toggle('east')" icon="ui-icon-triangle-1-e" title="ctr+shift+right arrow" style="width: 6px;height: 80px;position: absolute;top: 50%;" type="button"/> 
                      </h:form>
                        </p:layoutUnit>
                        <p:layoutUnit id="middlecenter" style="padding: 0px!important;" position="center">
                            <p:layout style="text-align: center">
                                <p:layoutUnit id="middlecenter1" style="padding: 0px!important;" position="center" resizable="true" >

                                        <p:outputPanel autoUpdate="true" id="dlgpanelcenter">                 
                                        <center>
                                            <ui:include src="./../users/networkReport.xhtml" />
                                        </center>
                                    </p:outputPanel>

                                </p:layoutUnit>                                
                                <p:layoutUnit id="middleBottom" size="100"  style=" padding: 0px!important" position="south" resizable="true" >



                                </p:layoutUnit>
                            </p:layout>
                        </p:layoutUnit>
                    </p:layout>
                </p:layoutUnit>
            </p:layout>
            <p:dialog id="dlg" resizable="false" maximizable="true" modal="true"  draggable="true" height="400"  widgetVar="dlg1" style="background-color: white!important;text-align: center!important;direction: ltr">

                <p:outputPanel style="direction: rtl" id="dlgpanel" >                   
                    <center>
                        <ui:include  src="#{adminC.url}" />
                    </center>
                   </p:outputPanel>

            </p:dialog>

        </h:body>
    </f:view>
</html>

这是在对话框中打开的页面:

 <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
            template="./../template/masterTemplate.xhtml"
            xmlns:p="http://primefaces.org/ui"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns="http://www.w3.org/1999/xhtml"
            xmlns:sec="http://www.springframework.org/security/tags">

<ui:define name="top">

</ui:define>
<ui:define name="content">
    <h:form id="regChannel" prependId="false" style="text-align: right;float: none!important">
      ........

   </h:form>        
</ui:define>
<ui:define name="bottom">

</ui:define>

最佳答案

摆脱所有嵌套表单 ( <h:form ),

我注意到你有很多这样的东西

页面上不能有以下结构

<h:form.....
  some elements....
  some elements....
  some elements....
  <h:form....

例如,您可以放置​​一个 <h:form这将包裹 <p:tab

或者放置<h:form每个里面<p:tab

检查您是否没有嵌套的另一种方法 <h:form就是在您的页面中查看源并查看是否有 <form里面<form (嵌套形式是 baaaad)

<小时/>

更新

您确定需要所有这些<ui:define在你的对话中?尝试删除所有 <ui:define + template="./../template/masterTemplate.xhtml"从里面ui:composition然后留下

<ui:composition....
    <h:form...

    </h:form>
</ui:composition>

关于javascript - 底面布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14314502/

相关文章:

javascript - jqgrid 是否支持行高,所以我可以在一行中显示多行

javascript - 如何在 JS 中检查 p :calendar value is empty?

azure - 如何使用Azure Powershell更改Azure WebApp的堆栈?

google-apps-script - Google 应用程序脚本部署为 Web 应用程序卡在获取数据

java - 需要从 webapp 执行 shell 脚本并在页面中显示控制台输出

javascript - ES6/下一个 : object destructuring with rest - grouping

javascript - 使用 Tampermonkey 在 AngularJS 网站上自动提交表单?

asp.net - javascript 函数与 asp.net 一起

ajax - Apache-Shiro : User authenticates within AJAX, 登录后如何恢复 GET-Variables?

jsf - JSF复选框监听器