0

I am using Primefaces 5.1 and have this strange behaviour.

If in my dataTable I have h:inputHidden then mymethod() is not fired. The method is fired if I remove it.

<p:dataTable id="tablerisorse" value="#{myBean.resources}" var="resource"  
        rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'oddRow' : 'evenRow'}" 
        rowIndexVar="rowIndex"
        emptyMessage="Empty" headerClass="header">

        <p:column>
            <h:inputHidden id="id_user" value="#{resource.user}"/>
            <f:facet name="header">
            <h:outputText  value="Surname"/> 
            </f:facet> 
            <h:outputText value="#{resource.surname}" /> 
        </p:column>     
        <p:column> 
            <p:commandLink id="linkdet"  actionListener="#{myBean.mymethod}" ajax="false"onstart="progressbar()" oncomplete="hideprogressbar()">
                 <p:graphicImage value="images/res.png" style="{border: 0}"></p:graphicImage>   
            </p:commandLink>
        </p:column>                                 
</p:dataTable>

the method is:

public void impegnirisorsa(ActionEvent ae) {
        // TODO Auto-generated method stub
        HtmlInputHidden uicid_user = (HtmlInputHidden) ae.getComponent().findComponent("id_user");
        String id_user = ""+uicid_user .getValue();
        System.out.println("id_user"+id_user);
    }

I wonder what the problem could be and which workarounds could I use.

Tarik
  • 4,961
  • 3
  • 36
  • 67
Gyonder
  • 3,674
  • 7
  • 32
  • 49
  • 1
    You can just pass the `{#resource.user}` as a parameter to the actionListener. But most likely the cause is validation errors. Add a p:/h:messages at bottom of the page. And a progressbar with a non-ajax request feels a bid weird. Does it work ok? And your method name and actionListener do not mach, also not parameter wise. Please create a *good* example – Kukeltje Feb 20 '15 at 14:57
  • 3
    Is this acceptable as dupe? http://stackoverflow.com/questions/4994458/how-can-i-pass-a-parameter-to-a-commandlink-inside-a-datatable It doesn't concretely answer your current [XY-problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem), but it *does* answer your initial X-problem for which you incorrectly thought that this particular Y-solution would be the right solution ;) – BalusC Feb 20 '15 at 16:55
  • Ok BalusC I am spoilt for choice.Thanks – Gyonder Feb 23 '15 at 11:08

0 Answers0