Rin*_*nov 1 javascript java layout primefaces jsf-2
我在Mojarra-2.1.10上使用primefaces PrimeFaces-3.4,我的整页布局是这样的.我如何在顶部制作一个按钮,这将折叠西部layoutUnit?
感谢帮助.
PS,早期假设可以写这样的东西:
<layoutUnit position="west" widgetVar='westlayout'> ... </layoutUnit>
//button in the top
<button onlick="westlayout.collapse()"></button>
Run Code Online (Sandbox Code Playgroud)
但遗憾的是,layoutUnit不存在widgetVar属性.
更新1:发现类似的问题,尝试过.没有为我工作,问题是具有更新属性的按钮无法找到具有此类标识符的文本,我在一个layoutUnit中尝试,找到了标识符,但也没有工作.
根据Layout Client Side API,您可以通过布局 widgetWar 切换layoutUnit:
<p:layout fullPage="true" widgetVar="layoutWdgt">
<p:layoutUnit position="north" size="100" header="Top" resizable="true" closable="true" collapsible="true">
<h:form>
<p:commandButton value="Toggle" onclick="layoutWdgt.toggle('west')"/>
</h:form>
</p:layoutUnit>
....
<p:layoutUnit position="west" size="200" header="Left" resizable="true" closable="true" collapsible="true">
<h:form>
<h:outputText value="West Layout unit"/>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:outputText value="Center Layout unit"/>
</p:layoutUnit>
</p:layout>
Run Code Online (Sandbox Code Playgroud)
EDITED
从PrimeFaces 4开始,仍支持id映射,但弃用PF('XXX')
对于PrimeFaces 5.0及更高版本,您需要使用PF widgetVar来调用客户端API.因此,不需要使用layoutWdgt.toggle('west')来切换西部布局单元,而是需要使用PF('layoutWdgt').toggle('west')
归档时间: |
|
查看次数: |
8646 次 |
最近记录: |