Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

p:ajax not working with p:commandButton

I try to do this but I never get it work ;why is that ajax not supported ??

<p:commandButton value="MAJ" rendered="#{LigneXL.resultat eq 'Pas de FMD'}" onclick="confirmation.show()"  >
    <f:setPropertyActionListener target="#{parserXls.selectitem}" value="#{LigneXL}" />                  
    <p:ajax event="click" listener="#{parserXls.listenercomposant()}"/>             
</p:commandButton> 

Listener is never executed Why !!! I'm trying to get another object according to selectitem

public void listenercomposant(){
    composantitem=ChercherComposant(selcetitem.getRefcomposant(), selcetitem.getReffabricant());
}
like image 709
Adriano_jvma Avatar asked Mar 23 '23 21:03

Adriano_jvma


1 Answers

The p:commandButton is already natively ajax enabled. So there is no need to have a p:ajax inside and and you can just use

  <p:commandButton value="TestButton" actionListener="#{bean.saveSomething}" id="id"    
  update="panel" />

As you can see p:commandButton already has and actionListener so just use that.

like image 95
Makky Avatar answered Apr 05 '23 15:04

Makky