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!

ADF Select Row Programatically

AmittAug 4 2015 — edited Aug 5 2015

Jdev 11.1.1.7

I have an Table with single row selection.

<af:table value="#{bindings.ApplicationsVO11.collectionModel}"

                                var="row"

                                rows="#{bindings.ApplicationsVO11.rangeSize}"

                                emptyText="#{bindings.ApplicationsVO11.viewable ? 'No data to display.' : 'Access Denied.'}"

                                fetchSize="#{bindings.ApplicationsVO11.rangeSize}"

                                rowBandingInterval="0" width="920"

                                filterVisible="true" varStatus="vs"

                                selectedRowKeys="#{bindings.ApplicationsVO11.collectionModel.selectedRow}"

                                selectionListener="#{viewScope.ApplicationBean.selectApplicationTable_SelectionListener}"

                                rowSelection="single" id="t1"

                                disableColumnReordering="true">

...

...

...

once i select the row, the selected row is displayed through output label, saying selected row through selectApplicationTable_SelectionListener method as:

<af:outputText value="#{viewScope.ApplicationBean.selectedApplication}"

                                        id="ot8" partialTriggers="t1"

                                        inlineStyle="font-weight:bold;"/>

    public void selectApplicationTable_SelectionListener(SelectionEvent selectionEvent) {

        DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();

        DCIteratorBinding dcItteratorBindings =bindings.findIteratorBinding("ApplicationsVO1Iterator");

        GenericTableSelectionHandler.makeCurrent(selectionEvent);

        // Get an object representing the table and what may be selected within it

        ViewObject voTableData = dcItteratorBindings.getViewObject();

       

        // Get selected row

        Row rowSelected = voTableData.getCurrentRow();

        if(rowSelected.getAttribute("Applicationname")!=null){

            String appName=(String)rowSelected.getAttribute("Applicationname");

            log.debug(rowSelected.getAttribute("Applicationname")+"    "+appName);

            setSelectedApplication(appName);

        }

    }

Now, I need to have a button which shall make the current selected row of ADF table to the 1st row.

i and able to set the output label through:

setSelectedApplication(row[0].getAttribute("Applicationname")!=null?row[0].getAttribute("Applicationname").toString():"");

but the table's selected row is not changed.

how can i achieve it?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2015
Added on Aug 4 2015
14 comments
1,843 views