Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Automatically select & deselect Checkbox in ADF Tree Component binded to programatically built TreeM

Dat LamJul 14 2015

Hi everyone,

I want to programatically create a popup containing checkbox tree with different levels. I create TreeModel in Bean following this Ashish Awasthi's Blog (Jdev/ADF): Populate af:treeTable programatically using POJO in Oracle ADF (11g & 12c)

checkbox.png

I have a value change event in each checkbox. Every time, checkbox is tick/untick, the tree model is fetched again and the popup blinks.

<af:tree binding="#{TreeMB.treeModel}" value="#{TreeMB.sendCaseOptionsTreeModel}" var="node"

                             id="t29" expandAllEnabled="true">

 \<f:facet name="nodeStamp">

      \<af:group id="g1">

           \<af:selectBooleanCheckbox value="#{node.sendCaseOptionValue}"

                selected="#{node.sendCaseOptionSelected}" id="sb1"

                valueChangeListener="#{TreeMB.selectSubSendCaseOptions}"

                autoSubmit="true"/>

           \<af:outputText value="#{node.sendCaseOptionValue}" id="ot36"/>

      \</af:group>

 \</f:facet>

</af:tree>

And method to handle checkbox tick/untick automatically

public void selectSubSendCaseOptions(ValueChangeEvent valueChangeEvent) {

    valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());

    sendCaseOptionsTreeModel.setRowKey(null);

    for (int i = 0; i \< sendCaseOptionsTreeModel.getRowCount(); i++) {

        sendCaseOptionsTreeModel.setRowIndex(i);

        SendCaseOptions option = (SendCaseOptions) sendCaseOptionsTreeModel.getRowData();

        if (sendCaseOptionsTreeModel.isContainer()) {

            sendCaseOptionsTreeModel.enterContainer();

            for (int j = 0; j \< sendCaseOptionsTreeModel.getRowCount(); j++) {

                sendCaseOptionsTreeModel.setRowIndex(j);

                SendCaseOptions subOption = (SendCaseOptions) sendCaseOptionsTreeModel.getRowData();

                if (option.isSendCaseOptionSelected()) {

                    subOption.setSendCaseOptionSelected(true);

                } else {

                    subOption.setSendCaseOptionSelected(false);

                }

            }

            sendCaseOptionsTreeModel.exitContainer();

        }

    }

    AdfFacesContext.getCurrentInstance().addPartialTarget(treeModel);

    // Avoid triggering the validation

    FacesContext.getCurrentInstance().renderResponse();

}

Is there anyway to prevent blinking of the popup (tick/untick checkbox without refreshing the popup and treemodel) ?. I want similar behavior to this Rohan Walia's Tech Blog: AutoSelect & Deselect Checkbox in ADF Tree Component

Please help. Thank you very much

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2015
Added on Jul 14 2015
0 comments
369 views