0

I am trying to make ajax call inside jsf dataTable on checkobx value change. But the corresponding backing bean is not getting fired.

When I tried the same thing outside dataTable, the ajax call is getting invoked and SOP's are getting printed.

Following is my code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    >

<h:body>
    <h:head></h:head>

    <section class="box"> 
     <h:form>

        <f:event type="preRenderView" listener="#{adminAccounts.getAppInfoNew()}" />
        <div class="row-fluid">
            <div class="span7" style="">
                <span class="heading">Manage Accounts</span>
            </div>
        </div>
    <!-- outside dataTable ajax call is working -->
        <h:selectBooleanCheckbox checked="checked"
            value="#{adminAccounts.testValue}">
            <f:ajax listener="#{adminAccounts.changingTabVisiblity}"></f:ajax>
        </h:selectBooleanCheckbox>



                    <h:dataTable id="diagnosis_list_2"
                        value="#{adminAccounts.appsList}" var="apps">                

                <h:column>                  
                 <f:facet name="header">Position</f:facet>

                    #{apps.appname}
                </h:column>

                        <h:column>
                            <f:facet name="header">Campaign Management</f:facet>

<!-- inside dataTable ajax call is not working -->
                            <h:selectBooleanCheckbox  checked="checked"
                                value="#{adminAccounts.testValue}">
                                <f:ajax listener="#{adminAccounts.changingTabVisiblity}"></f:ajax>
                            </h:selectBooleanCheckbox>



                        </h:column>

                    </h:dataTable>
               </h:form> 
 </section>

</h:body>
</html>

Also following is the bean class

@ManagedBean(name = "adminAccounts")
@RequestScoped
public class AdminAccounts {

    private List<AppDummyList> appsList = new ArrayList<AppDummyList>();
    public boolean testValue;
    public boolean testValue1;


    public boolean isTestValue1() {
        return testValue1;
    }

    public void setTestValue1(boolean testValue1) {
        this.testValue1 = testValue1;
    }

    public boolean isTestValue() {
        return testValue;
    }

    public void setTestValue(boolean testValue) {
        this.testValue = testValue;
    }
public List<AppDummyList> getAppsList() {

        return appsList;
    }

    public void setAppsList(List<AppDummyList> appsList) {
        this.appsList = appsList;
    }


    public void getAppInfoNew() {
        System.out.println("get info called");
        appsList.add(new AppDummyList("amazon"));
        appsList.add(new AppDummyList("bookmyshow"));
        appsList.add(new AppDummyList("flipkart"));
        appsList.add(new AppDummyList("foodpanda"));
    }


    public void changingTabVisiblity() {
        System.out.println("value=" + testValue);
        System.out.println("value1=" + testValue1);

    }

}

Need help on why the ajax call not working inside dataTable.

mihir S
  • 617
  • 3
  • 8
  • 23
  • duplicate? http://stackoverflow.com/questions/2118656/commandlink-commandbutton-ajax-backing-bean-action-listener-method-not-invoked – Kukeltje Jul 02 '15 at 07:33
  • @Kukeltje out of the 12 pounts given in that answer, if felt point no.4 is applicable to me and tried that solution, but it did't work... – mihir S Jul 02 '15 at 07:54
  • 2
    Then post a MCVE. There's too much ambiguity here. – BalusC Jul 02 '15 at 07:57
  • @Balsuc I have posted the edited jsf page and also provided the bean java class..is it fine now? – mihir S Jul 02 '15 at 12:53

0 Answers0