[英]JSF Call javascript function after Ajax update
我有jsf代码,它在javascript点击后调用隐藏按钮点击功能,执行ajax请求并刷新页面。 但是当ajax返回新值时,我想调用另一个javascript函数。 这是我的代码
<h:panelGrid styleClass="float-left" columns="2">
<h:outputText value="Хранилище ключей: " />
<h:panelGroup>
<p:inputText value="#{SessionBean.getCurrentLocaleName(SessionBean.userProfileController.keySettingsForm.storage)}" onclick="$('#selectStorageB').click();" onchange="" readonly="true" style="cursor: text; width: 275px;" />
<p:commandButton id="selectStorageB" style="display: none;"
actionListener="#{SessionBean.storageController.selectStorageForm.openSelectStorageDialog}">
<p:ajax event="dialogReturn" update=":indexForm" process=":indexForm" immediate="true"
listener="#{SessionBean.userProfileController.keySettingsForm.onStorageChosen}" oncomplete="chooseStoragePath(#{SessionBean.userProfileController.keySettingsForm.storage.alias})" />
</p:commandButton>
<p:commandButton icon="ui-icon-cancel" immediate="true" style="width: 18px; white-space: pre-wrap; margin-left: 5px"
actionListener="#{SessionBean.userProfileController.keySettingsForm.resetSigningStorageName()}" update=":indexForm">
</p:commandButton>
</h:panelGroup>
</h:panelGrid>
我的问题是javascript函数没有看到新的值。
由于您使用Primefaces你可以从你的行动方法在你ManagedBean本身使用Primefaces调用JavaScript函数的RequestContext的执行方法。
String script = "chooseStoragePath('"+PATH_VAR+"')";
RequestContext.getCurrentInstance().execute(script);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.