FILL Checkbox by default in JSF

0

I do not know how to do it. The only way I have is this:

public void on NodeSelect (ValueChangeEvent event) {

    Boolean selected = (Boolean) event.getNewValue();
    Long odmId = (Long)((UIInput) event.getSource()).getAttributes().get(ODM_ID);

    if(selected){       
        listOdmIds.add(odmId);      
    }else{
        listOdmIds.remove(odmId);
    }

}

I want them to be selected automatically.

Here I leave the xhtml:

    <div class="col-sm-8">
                            <!-- Arbol de Odms -->
                            <p:treeTable id="odmTreeTable" value="#{statisticsBean.root}"
                                var="node" scrollable="true" scrollHeight="300"
                                expandMode="true"
                                selection="#{statisticsBean.lSelectedOdmHeaderDTO}"
                                emptyMessage="No hay datos">

                                <p:column headerText="ODM" style="width: 60%;text-align: left;">
                                    <h:outputText
                                        style="font-weight:#{node.cedistName eq null ? 'bold' : 'normal'}"
                                        value="#{node.name}" />
                                </p:column>
                                <p:column headerText="Seleccionar" styleClass="text-center"
                                    style="width: 20%">


                                    <p:selectBooleanCheckbox id="checkTreeTable" disabled="#{empty statisticsBean.messageType}"
                                        value="#{node.selected}"
                                        rendered="#{node.cedistName eq null ? false : true}"
                                        valueChangeListener="#{statisticsBean.onNodeSelect}">
                                        <f:attribute name="odmId" value="#{node.id}" />
                                        <p:ajax event = "change" global="true" update=":form:odmTreeTable" />
                                    </p:selectBooleanCheckbox>



                                </p:column>
                            </p:treeTable>
                        </div>
    
asked by Manuee 30.07.2018 в 11:29
source

0 answers