Re-Enabled CommandButton doesn't fire ActionListener

UI Components for JSF
Post Reply
Gerhard.Ruckriegel
Posts: 2
Joined: 21 Dec 2011, 12:02

21 Dec 2011, 12:11

Occurred in 3.0 RC1 and RC2

I have a disabled command button that is enabled after a selection in a datatable is made:

Code: Select all

<p:commandButton widgetVar="showImageButton" value="Compare Reference Images" update="imageForm"
disabled="true" actionListener="#{reportDetailsBean.showImage}" oncomplete="imgDialog.show();" />
...

Code: Select all

<p:dataTable id="dataTable" value="#{reportDetailsBean.reportDetails}" var="bean"
rowKey="#{bean.siteId}" selection="#{reportDetailsBean.selectedRow}" selectionMode="single">
   <p:ajax event="rowUnselect" onstart="showImageButton.disable();" />
   <p:ajax event="rowSelect" onstart="showImageButton.enable();" />
reportDetailsBean.showImage won't be fired despite the button is enabled and oncomplete gets invoked as well.

If I change disabled="false", then it get's fired.

glister
Posts: 64
Joined: 19 Jan 2010, 11:39

21 Dec 2011, 12:49

@Gerhard.Ruckriegel:

i would try to set a id in your commandButton and insert an update attribut in your p:ajax component.

Code: Select all

<p:ajax event="rowSelect" onstart="showImageButton.enable();" update="idOfYourButton"/>
perhaps this could help.

Regards,

glister
PrimeFaces version:
using Primefaces 5.2.11 on a Glassfish v4.1 Server

Additional Libraries:
using PrimeFaces Extensions 3.2
using OmniFaces 2.1

Additional Books:
PrimeFaces Cookbook

Gerhard.Ruckriegel
Posts: 2
Joined: 21 Dec 2011, 12:02

21 Dec 2011, 13:00

glister wrote:@Gerhard.Ruckriegel:

i would try to set a id in your commandButton and insert an update attribut in your p:ajax component.

Code: Select all

<p:ajax event="rowSelect" onstart="showImageButton.enable();" update="idOfYourButton"/>
perhaps this could help.

Regards,

glister
no, doesn't work...

However for the time being I found a workaround:

while loading the page the button is disabled="false", but on starting the page I disable the button via javascript:

Code: Select all

<script>
	$(document).ready(function() {
		showImageButton.disable();
	});
</script>
...

Code: Select all

<p:commandButton widgetVar="showImageButton" value="Compare Reference Images" update="imageForm"
disabled="false" actionListener="#{reportDetailsBean.showImage}" oncomplete="imgDialog.show();" />

chsmcol
Posts: 4
Joined: 19 Jan 2016, 03:19
Location: Charlotte
Contact:

02 Mar 2016, 20:12

Yeah, it works if you disabled it via javascript and then enable it via javascript...
Thanks for you help. I was having the same problem.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 54 guests