简体   繁体   中英

RichFaces button enable disable based on a4j:status

My requirement is that a4j:commandButton should be disable on click, it should remain disabled till data is loaded in rich:dataTable .

Can you please tell me how can we implement it. Can we use a4j:status for this. I am already using a4j:status for showing progress. Can we capture start and end flag of a4j:status and based on that we can enable and disable a4j:commandButton .

You can try this if you're using JQuery:

 <a4j:commandButton onbegin="$(this).prop('disabled',true);" oncomplete="$(this).prop('disabled',false);" />

When you click on the button the onbegin JS is called and when your AJAX request completes, the oncomplete will be called which will enable the button again.

If not using JQuery use plain javascript (foo is your element):

foo.disabled = true;
foo.disabled = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM