Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.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
Button 按下按钮时显示面板_Button_Primefaces_Panel - Fatal编程技术网

Button 按下按钮时显示面板

Button 按下按钮时显示面板,button,primefaces,panel,Button,Primefaces,Panel,我有一个按钮和一个面板。我希望按下按钮时面板可见。我怎么才能用素面画呢 我有密码 <p:commandButton value="Search" ajax="false" actionListener="#{myBean.searchPatients}" onclick="panelwv.show();"> </p:commandButton> <p:panel widgetvar="panelwv" visible=

我有一个按钮和一个面板。我希望按下按钮时面板可见。我怎么才能用素面画呢

我有密码

        <p:commandButton value="Search" ajax="false"
        actionListener="#{myBean.searchPatients}" onclick="panelwv.show();">
    </p:commandButton>
    <p:panel widgetvar="panelwv" visible="false" closable="true" toggleable="true" >


但是它不起作用

如果代码中有输入错误,则需要的属性是
widgetVar

<p:commandButton value="Search" ajax="false"
    actionListener="#{myBean.searchPatients}" onclick="panelwv.show();">
</p:commandButton>
<p:panel widgetVar="panelwv" visible="false" closable="true" toggleable="true"/>


如果你不想渲染你的面板,你应该考虑使用组件的<代码>渲染< /代码>属性。

你可以使用对话框。您也可以检查这个



如果我想在searchPatients方法完成时显示面板,我应该更改什么?在这种情况下,您需要等待搜索完成,然后打开面板
oncomplete=“panelwv.show();”
。您还应该更改
ajax=“true”
,我不确定这在
ajax=“false”
中应该如何工作。使用ajax=“true”面板中的元素不是从我的bean计算出来的,而使用ajax=“false”面板根本不会出现,因为这些注释中讨论的问题不再是“按下按钮时显示面板”,我建议您发布一个新问题,并留下正确答案。无论如何,您的面板元素没有在bean中计算这一事实可能意味着您没有在bean中计算这些值。如果你认为情况并非如此,那么就用你的具体问题提出一个新问题。另见我之前的评论。
<p:commandButton value="Search" ajax="false"
actionListener="#{myBean.searchPatients}" oncomplete="PF('dlg1').show();">
</p:commandButton>
<p:dialog header="Basic Dialog" widgetVar="dlg1" minHeight="40">
<p:panel  visible="false" closable="true" toggleable="true"/>
</p:dialog>