This discussion is archived
7 Replies Latest reply: Jun 19, 2011 6:28 PM by 220431 RSS

row selection on a  table (Data pushed by ADS)

220431 Newbie
Currently Being Moderated
Hi,

I have a table and data is pushed or updated by ADS to the table, I have a requirement to show the data of the row from table which will be double clicked on any row. can any one please let me know how can get the double clicked row from table to managedbean?


Thank
Shiva
  • 1. Re: row selection on a  table (Data pushed by ADS)
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    you use af:clientListener on the table. This then calls af:serverListener on the same table. The af:serverListener calls a managed bean, which then access the table.

    Here you call getSelectedRowKeys() to get the RowKeySet with the selected rows. Each entry is of type list indetifying the key path of the row. You can use the key to get the table data or, using ADF, to make this row current in the ADF binding

    Frank
  • 2. Re: row selection on a  table (Data pushed by ADS)
    vinod_t_krishnan Guru
    Currently Being Moderated
    chk this link
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/56-handle-doubleclick-in-table-170924.pdf
    http://technology.amis.nl/blog/3845/adf-11g-richfaces-handling-the-client-side-double-click-to-invoke-a-server-side-operation
  • 3. Re: row selection on a  table (Data pushed by ADS)
    220431 Newbie
    Currently Being Moderated
    Thanks

    Appreciate your quick reply.

    before posting this here i did followed the links you posted and adf code corner and some blogs , I couldn't able to get the double clicked row in Managed bean, from below code keys is not Null but does not Iterate while loop as keys.hasNext() is returning false it seems.

    public void handleTableDoubleClick(ClientEvent ce) {

    System.out.println("inside handleTableDoubleClick");
    Iterator keys = getUmgtable().getSelectedRowKeys().iterator();
    if(keys == null)
    System.out.println("got the keys null ");
    else
    System.out.println("got the keys not null ");

    while (keys.hasNext()) {
    System.out.println("Iterating the Keys");

    Key key = (Key)((List)keys.next()).get(0);
    String kyn = (String)key.getKeyValues()[0];
    Number test_if_above_kyn_fails = (Number)key.getKeyValues()[0];
    }



    please kindly find table tags i have and Managed been content

    <af:table value="#{umgModel}" var="row"
    rows="#{bindings.applianceStatusList.rangeSize}"
    emptyText="#{bindings.applianceStatusList.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.applianceStatusList.rangeSize}"
    rowBandingInterval="0"
    selectedRowKeys="#{bindings.applianceStatusList.collectionModel.selectedRow}"
    selectionListener="#{bindings.applianceStatusList.collectionModel.makeCurrent}"
    rowSelection="single" id="t1"
    binding="#{umgStatusInfoHolder.umgtable}">
    <af:column sortProperty="umgname" sortable="false"
    headerText="NAME"
    id="c2">
    <af:outputText value="#{row.umgname}" id="ot3"/>
    </af:column>
    <af:column sortProperty="rack" sortable="false"
    etc.,
    </af:column>
    <af:clientListener type="dblClick" method="handleTableDoubleClick"/>
    <af:serverListener type="TableDoubleClickEvent" method="#{umgStatusInfoHolder.handleTableDoubleClick}"/>
    </af:table>


    umgModel is a Managed Bean which extends ActiveCollectionModelDecorator ,


    Thanks
    Shiva
  • 4. Re: row selection on a  table (Data pushed by ADS)
    220431 Newbie
    Currently Being Moderated
    any help on this please
  • 5. Re: row selection on a  table (Data pushed by ADS)
    pramodgujjeti Newbie
    Currently Being Moderated
    Did u get any solution for this! I want to set selected row keys on table based on List populated from bean?
  • 6. Re: row selection on a  table (Data pushed by ADS)
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    as far as I can tell, the code should work. When you try double clicking twice, does it make a difference ? Note that your JavaScript function should not call cancel() on the event argument

    Frank
  • 7. Re: row selection on a  table (Data pushed by ADS)
    220431 Newbie
    Currently Being Moderated
    Hi Frank,

    on Double Click i see "<CurrencyRowKeySet> <_computeCurrentRowKey> ADFv: rowIterator is null. " in logs also randomly on double click i see

    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.List

    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #1


    Also please find the javascript below

    <af:document id="d1">
    <af:resource type="javascript">
    function handleTableDoubleClick(evt) {
    //alert('Inside java Script');
    var table = evt.getSource();
    AdfCustomEvent.queue(table, "TableDoubleClickEvent",
    {
    },
    true);
    // evt.cancel();

    }
    </af:resource>

    Thanks

Legend

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