Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 设置折叠面板的热键_Jsf_Primefaces - Fatal编程技术网

Jsf 设置折叠面板的热键

Jsf 设置折叠面板的热键,jsf,primefaces,Jsf,Primefaces,我们的项目使用JSF2.2 primeface 5.1 我有一个可切换面板,collapse属性设置为true <p:panel id="panel1" toggleable="true" collapsed="true"> ... </p:panel> ... 如何在jsf页面中设置p:hotkey以将属性折叠更改为false?在基本级别上,您可以使用以下命令展开窗格: <p:hotkey bind="ctrl+s" handler="thePanelWi

我们的项目使用JSF2.2 primeface 5.1

我有一个可切换面板,collapse属性设置为true

<p:panel id="panel1" toggleable="true" collapsed="true">
...
</p:panel> 

...

如何在jsf页面中设置p:hotkey以将属性折叠更改为false?

在基本级别上,您可以使用以下命令展开窗格:

<p:hotkey bind="ctrl+s" handler="thePanelWidgetVar.expand();" />
然后可以使用
togglePanelState

 <p:hotkey bind="ctrl+s" handler="togglePanelState(thePanelWidgetVar);" />

问题目标是PF 5.1,您可能需要使用访问小部件的快捷方式更新答案,
PF('thePanelWidgetVar')
。此外,不需要使用函数来进行切换(这将不会调用onShow处理程序!),最简单的格式是
handler=“PF('thePanelWidgetVar').toggle()”
,并且对事件很友好:)感谢@hatemaliam的更新,我将包括它。
 <p:hotkey bind="ctrl+s" handler="togglePanelState(thePanelWidgetVar);" />
 <p:hotkey bind="ctrl+s" handler="PF('thePanelWidgetVar').toggle();" />