This discussion is archived
8 Replies Latest reply: May 24, 2012 11:43 PM by Frank Nimphius RSS

clickable Af: iterator childs

Vik Kumar Explorer
Currently Being Moderated
Hie

To the table row in a different layout I am using af:iterator component. This works great

However, I am now stuck on how to be able to click on a particular row like we can do it in the table ?

Any advise please
  • 1. Re: clickable Af: iterator childs
    Sudipto Desmukh Expert
    Currently Being Moderated
    The iterator doesnot maintain row currency like a af:table. You will need to programmatically get a handle to it accessing the node variable or by accessing the child node if you have a tree like structure.
    Some hints here - Re: af:iterator
  • 2. Re: clickable Af: iterator childs
    Vik Kumar Explorer
    Currently Being Moderated
    Sorry this does not answer my question.

    My question is more of is there a way to click on one of the row (rendered using iterator) the way we do in the table ?

    So, I am not concerned on the row currency part. but how to actually be able to click on the row.
  • 3. Re: clickable Af: iterator childs
    Sudipto Desmukh Expert
    Currently Being Moderated
    Since there is no row selection option in an iterator you can't click on a row. What's you exact requirement out there .. what do you want to do after clicking the row ?
    Though you can click on a commandLink and write some custom code to get the currentRow as mentioned here -
    http://andrejusb.blogspot.in/2011/05/oracle-adf-11g-custom-table-pagination.html

    Edited by: Sudipto Desmukh on May 25, 2012 1:16 AM
  • 4. Re: clickable Af: iterator childs
    Vik Kumar Explorer
    Currently Being Moderated
    thanks for the reply

    I want to show some contextual information on click the whole row. So that is why want to be able to select a particular row the way we do in a table.

    i know by default it is not possible.

    so any workaround solutions or ideas?
  • 5. Re: clickable Af: iterator childs
    raphael rodrigues - oracle Journeyer
    Currently Being Moderated
    Hi,
    One possible approach, hypothetically, is you use a commandLink or selectBooleanCheckbox, and in the click event you pass some information by parameters.

    In this post https://blogs.oracle.com/jdevotnharvest/entry/passing_parameters_to_managed_bean_method_using_el, Frank shows how you could pass parameters using managed bean and EL.

    Regards,
  • 6. Re: clickable Af: iterator childs
    Shay Shmeltzer Employee ACE
    Currently Being Moderated
    Just add a link instead of output text and then you can use a setActionListener to get the value that was clicked.
    So for example
            <af:form id="f1">
                <af:iterator id="i1" value="#{bindings.DepartmentsView1.collectionModel}" var="row">
                    <af:commandLink id="ot2" text="#{row.DepartmentName}">
                        <af:setActionListener from="#{row.DepartmentName}" to="#{viewScope.a}"/>
                    </af:commandLink>
                    <af:outputText value="#{row.DepartmentId}" id="ot1">
                        <af:convertNumber groupingUsed="false"
                                          pattern="#{bindings.DepartmentsView1.hints.DepartmentId.format}"/>
                    </af:outputText>
                </af:iterator>
                <af:commandButton text="commandButton 1" id="cb1" actionListener="#{a.a}"/>
            </af:form>
  • 7. Re: clickable Af: iterator childs
    Vik Kumar Explorer
    Currently Being Moderated
    sorry looks like i m still not clear with my question.

    I actually want the whole area to be clicked which is under iterator rather a single link etc. My ultimate requirement is also to be able to change the background color of the selected
    row to indicate it is selected.

    Any possibilites?
  • 8. Re: clickable Af: iterator childs
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    sounds like you want to create your own table select behavior - just without table. As far as I know the select behavior could only be achieved using JavaScript (click event) on the surrounding layoutComponent plus all its input components (focus event). You need a server listener to notify the server about the selected row (set current row). For the background color, best is to use client side JS to change the style of the layout component that is iteratively stamped by the iterator.

    Frank

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points