如何禁用/启用按钮(素数)? [英] How to disable/enable a button (primefaces)?
本文介绍了如何禁用/启用按钮(素数)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Primefaces,最初我的按钮被禁用,点击搜索"并等待搜索()功能完成后,必须启用下载"按钮,我尝试这样做:>
I'm working with Primefaces, Initially my button is disabled, after clicking on "Search" and waiting that a search() function is finished, the button "Download" must be enabled, I tried to do this :
<h:form id="myForm" method="post">
<p:commandButton id="search" value="Search" action="#{myBean.search}"/>
<p:commandButton id="download" value="Download" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop)" style="display:none">
<p:fileDownload value="#{myBean.file}" />
</p:commandButton>
</h:form>
我的 JQuery 代码如下所示:
My JQuery code look like this :
$(document).ready(
function(){
$("#myForm:search").change()(
function(){
if ($(this).val()) {
document.getElementById("download").style.display='block';
}
}
);
})
我的按钮Downalod"总是隐藏的,我的 jquery 文件包含在我的 xhtml 页面中.
My button "Downalod" is always hidden and my jquery file is included in my xhtml page.
推荐答案
你可以试试这个.
<p:commandButton id="search" value="Search"
action="#{myBean.search}"
oncomplete="downloadWV.jq.show()"/>
<p:commandButton id="download"
widgetVar="downloadWV"
value="Download"
ajax="false"
onclick="PrimeFaces.monitorDownload(start, stop)"
style="display:none">
<p:fileDownload value="#{myBean.file}" />
</p:commandButton>
这篇关于如何禁用/启用按钮(素数)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文