Closed melloware closed 4 years ago
OK I was able to reproduce it! pfe-761.zip
if you run that sample app and press each button they will all say "button0" in the alert. However if you remove the CommandButtonSingleClick renderer it works fine and each button reports its proper value.
Let me have a look. I think we can use PrimeFaces.getWidgetById(clientId)
.
Weird.. the rendered onclick
of button 0:
PrimeFaces.bcn(this,event,[function(event){var w=PF('widget_j_idt5_tblCars_0_btnActions');if(w){w.disable();};},function(event){PrimeFaces.ab({s:"j_idt5:tblCars:0:btnActions",f:"j_idt5",p:"j_idt5:tblCars:0:btnActions",onco:function(xhr,status,args,data){var w=PF('widget_j_idt5_tblCars_0_btnActions');if(w){w.enable();};alert('j_idt5:tblCars:0:btnActions');;}});return false;}]);
and button 4:
PrimeFaces.bcn(this,event,[function(event){var w=PF('widget_j_idt5_tblCars_4_btnActions');if(w){w.disable();};var w=PF('widget_j_idt5_tblCars_3_btnActions');if(w){w.disable();};var w=PF('widget_j_idt5_tblCars_2_btnActions');if(w){w.disable();};var w=PF('widget_j_idt5_tblCars_1_btnActions');if(w){w.disable();};var w=PF('widget_j_idt5_tblCars_0_btnActions');if(w){w.disable();};},function(event){PrimeFaces.ab({s:"j_idt5:tblCars:4:btnActions",f:"j_idt5",p:"j_idt5:tblCars:4:btnActions",onco:function(xhr,status,args,data){var w=PF('widget_j_idt5_tblCars_4_btnActions');if(w){w.enable();};var w=PF('widget_j_idt5_tblCars_3_btnActions');if(w){w.enable();};var w=PF('widget_j_idt5_tblCars_2_btnActions');if(w){w.enable();};var w=PF('widget_j_idt5_tblCars_1_btnActions');if(w){w.enable();};var w=PF('widget_j_idt5_tblCars_0_btnActions');if(w){w.enable();};alert('j_idt5:tblCars:0:btnActions');;}});return false;}]);
The issue is with prefixing and setting the attributes: https://github.com/primefaces-extensions/core/blob/primefaces-extensions-8.0/src/main/java/org/primefaces/extensions/renderer/CommandButtonSingleClickRenderer.java#L35-L36
Yeah its like its additive.
Also go to this example in the showcase: https://www.primefaces.org/showcase-ext/sections/slideout/basicUsage.jsf
You can only click the buttons once.
Also go to this example in the showcase: https://www.primefaces.org/showcase-ext/sections/slideout/basicUsage.jsf
You can only click the buttons once.
Hmm.. those buttons don't have an action. I'll throw in a check on that as well.
If you have a Datatable with a CommandButton in the first column.
Because in encodeMarkup we are calling button.resolvewidgetVar() it is resolving it incorrectly.
All of the buttons in my table are being rendered with widgetVar :0:
instead of