users@jsf-extensions.java.net

radio buttons inside datatable

From: terry.human <terry.human_at_yahoo.es>
Date: Wed, 8 Apr 2009 13:09:18 -0700 (PDT)

Hello,

I have a problem using radio buttons inside a datatable.

I have in my backing bean:

private Integer id; //For radio button component value
private int selectedRowId = -1; // For radio button item value, also used
as selected row ID.
private TableRow selectedRow; // For table row data.


        public void handleRadio1ValueChange(ValueChangeEvent valueChangedEvent) {
                selectedRowId = getTable1().getRowIndex();
                     selectedRow = (TableRow)getTable1().getRowData();
        }

            public void onAceptarClick(){
                         System.out.println("The value of selectedRowId is
"+selectedRowId);
            }
        
and in the jsp:
<hx:dataTableEx....>
<hx:selectOneRadio id="radio1"
        disabledClass="selectOneRadio_Disabled"
        styleClass="selectOneRadio"
valueChangeListener="#{pc_RowSelectRadioButtonInDataTableView.handleRadio1ValueChange}
onclick="return radiobuttonClick(this, event);"
value="#{pc_RowSelectRadioButtonInDataTableView.id}"
onchange="submit()">
                                                                                        <f:selectItem
itemValue="#{pc_RowSelectRadioButtonInDataTableView.selectedRowId}" />

</h:selectOneRadio>
</dataTable>

When the user click on a radiobutton and then click on "aceptar" I get well
the value of selectedRowId the firt time, but if the user click in other
radiobutton and then click on "aceptar" I get a wrong value of selectedRowId
(I get "-1")

Could you help me?

Thanks.

-- 
View this message in context: http://www.nabble.com/radio-buttons-inside-datatable-tp22958193p22958193.html
Sent from the jsf-extensions users mailing list archive at Nabble.com.