【发布时间】:2014-08-11 08:58:06
【问题描述】:
我一直在尝试添加一些功能来展开/折叠 primefaces 中的 layoutUnit,但我似乎无法让它工作。我在这里找到了另外两个答案,但它们都不适合我:
Primefaces, how to collapse layoutUnit using some script or jquery function
Primefaces,how to collapse layoutUnit with another button?
例如我测试了以下代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:pf="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<pf:layout fullPage="true" widgetVar="layoutWdgt">
<pf:layoutUnit position="north" size="100" header="Top" resizable="true" closable="true" collapsible="true">
<h:form>
<pf:commandButton value="Toggle" onclick="layoutWdgt.toggle('west')"/>
</h:form>
</pf:layoutUnit>
<pf:layoutUnit position="west" size="200" header="Left" resizable="true" closable="true" collapsible="true">
<h:form>
<h:outputText value="West Layout unit"/>
</h:form>
</pf:layoutUnit>
<pf:layoutUnit position="center">
<h:outputText value="Center Layout unit"/>
</pf:layoutUnit>
</pf:layout>
</h:body>
</html>
这行不通。西部布局单元标题上的默认展开折叠图标展开/折叠西部布局单元,但是北部布局单元中的“切换”按钮似乎只是重新加载页面而不更改任何内容。
这是使用 primefaces 5。有什么想法吗?
【问题讨论】:
标签: jquery jsf-2 primefaces