0
votes

I have a primefaces commandButton outside of a data table which functions properly. Inside a dataTable, I have the exact same commandButton, but when the one inside the dataTable is clicked, it doesn't call the actionListener:

 <h:body>
    <h:form>
        <p:messages autoUpdate="true" showDetail="true" closable="true"/>
        <p:accordionPanel >  
            <p:tab title="Visualize data">
                <p:commandButton value="Add Domain" actionListener="#{TripleStoreController.addDomain('Domain')}"
                                 update="DomainSkillTable"/>
                <p:dataTable 
                    id="DomainSkillTable"
                    var="result"
                    value="#{TripleStoreController.domainResults}"
                    rowKey="#{result}">
                    <p:column>
                        #{result}
                    </p:column>
                    <p:column>
                        <p:commandButton value="Add Domain" actionListener="#{TripleStoreController.addDomain('Domain')}"
                                         update="DomainSkillTable"/>
                    </p:column>
                </p:dataTable>
            </p:tab>
        </p:accordionPanel>  
    </h:form>
</h:body>
2
I copied and pasted your code into a webpage and created a backing bean with that method and property, and both buttons work, so I'm not sure what is going on with your case. I am using PrimeFaces 4.0, JSF Mojarra 2.2.1, and GlassFish EL 2.2. Do you get any error messages on the datatable button?LucasP
@LucasP I did not get an error message associated with the datatable button.Nick

2 Answers

0
votes

it should be work. there is no error, i had just copy and and make back bean for the same method TripleStoreController.addDomain('Domain') in my java class the method signature like public void addDomain(String s) and method worked. even i got the value pass by command button as 'Domain' in my back bean.

-1
votes

in my case, i just made my bean from @RequestScoped to @ViewScoped and it solved my problem.