tags:

views:

42

answers:

1

I want to get selected row data from ice:datatable ? Here is me code , please give me your suggestion to get selected row data using rowselector.

Backingbean:

public void rowSelectionListener(RowSelectorEvent event) {
    System.out.println(event.getRow());
}

jspx code:

    <ice:rowSelector id="selected"  selectionListener="#{inventoryList.rowSelectionListener}" multiple="false" selectedClass="tableRowSelected" mouseOverClass="tableRowMouseOver" />
    <f:facet name="header">
        <ice:outputText value="Stock #"/>
    </f:facet>
    <ice:outputText value="#{item.stock}"/>
</ice:column>

Now I am able to get row index, but I need to get selected row value. How can I do that?

A: 

You can get the desired row by binding the table(HtmlDataTable) in backing bean, and on action or some other event you can get the selected row by tableBinding.getRowData() returning the object from the list that was used in table.

Nayan Wadekar