是什么区别action和actionListener,什么时候应该使用action与actionListener?
究竟是什么process,并update在PrimeFaces p:commandXxx组件和execute和render的f:ajax标签?
哪个在验证时有效?什么是update属性做,而不是更新的值从后端组件?不要process属性绑定值模型?究竟是什么@this,@parent,@all并@form在这两个属性?
下面的例子工作正常,但我对基本概念有点困惑.
<p:commandButton process="@parent"
update="@form"
action="#{bean.submit}"
value="Submit" />
Run Code Online (Sandbox Code Playgroud) 我有一个p:commandLink单击启动对话框.此外还有一个动作,必须在启动对话框之前执行,因为对话框取决于动作填充的内容.
如何在没有 javascript的情况下启动弹出窗口之前运行操作?
<p:commandLink action="#{service.computePrefetch(_var)}" onclick="dlg.show()"/>
Run Code Online (Sandbox Code Playgroud) 我有一个 ajax commandButton,当我点击它时,它会更新我使用的表单并在 onclick 方法上调用一个 js 函数。
问题:一个字段起初是不可见的,我使用style="display:none"forinvisibilty。当我单击按钮时,它会更新表单数据并显示:none 仍然存在。在 onclick 命令上,我使用 js 函数style="display:none将style="display:block".
这是我的 js 函数:
setTimeout(function() {
PF('field').jq.css('display', 'block');
}, delay);
Run Code Online (Sandbox Code Playgroud)
我使用延迟来等待更新完成其工作。
这是我的命令按钮:
<p:commandButton ajax="true" update="form" onclick="jsFunc();"</p:commandButton>
Run Code Online (Sandbox Code Playgroud)
但是我想确定 ajax update 什么时候完成它的工作,然后我想调用 js 函数。
做这个的最好方式是什么 ?
提前致谢。
我在单击时显示对话框有问题。这是显而易见的,但我无法发现该错误。我已经坚持了好几天,这太疯狂了。你能帮我吗。
<h:form id="form">
<p:commandButton
rendered="#{characterBean.characterSession.characterName ne null}"
value="#{characterBean.characterSession.title.titleName}"
icon="fa fa-fw fa-edit" onclick="PF('dlg').show();"
update="@form"/>
<p:dialog id="titleDetail" header="#{i18n['title.yourTitles']}"
widgetVar="dlg" dynamic="true" closable="false" resizable="false"
showEffect="fade" hideEffect="fade">
<h:panelGroup>
<p:messages autoUpdate="true" />
<h:selectOneMenu id="titleSelect" converter="#{titleConverter}"
value="#{characterBean.characterSession.title}">
<f:selectItems value="#{characterBean.titleUnlocked}" var="t"
itemValue="#{t}" itemLabel="#{t.titleName}" />
</h:selectOneMenu>
<hr />
<h:panelGrid columns="2" style="width: 100%; text-align:center">
<p:commandButton value="#{i18n['general.submit']}"
icon="fa fa-check"
actionListener="#{characterBean.updateCharacterTitle}"
oncomplete="PF('dlg').hide();" update="@form" />
<p:commandButton value="#{i18n['general.cancel']}"
icon="fa fa-close" action="#{characterBean.submitCancel}"
oncomplete="PF('dlg').hide();" update="@form" process="@this" />
</h:panelGrid>
<p:remoteCommand name="updateForm()" process="@this" update="@form" />
</h:panelGroup>
</p:dialog>
</h:form>
Run Code Online (Sandbox Code Playgroud)