2 Replies Latest reply on Jan 11, 2010 1:32 AM by jsfgeeks

    SelectOneRadio inside extendedDataTable not working properly

    jsfgeeks

      Hi all,

       

           I have a page with extendedDataTable in my application. In that table, I have a column with <h:selectOneRadio> inside that. Now what I want is, if there are multiple rows in a table, then the user can select only one radio button at a time (as it works generally). But in my case it is working like check box. I ca select any number of radio buttons (in fact all at a time). Here is my code for extendedDataTable,

       

      <rich:extendedDataTable id="extdtable_cars" var="row"
                                                      binding="#{mybean.extdtable_cars}"
                                                      value="#{mybean.existing_car_list}"
                                                      style="left: 30px; top: 40px; position: absolute"
                                                      onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                                                      onRowMouseOut="this.style.backgroundColor='#FFFFFF'"
                                                      width="750px" height="200px"
                                                      enableContextMenu="false"
                                                      rowKeyVar="rkv" noDataLabel="No cars available" rows="0">
                                  <f:facet name="header">
                                      <h:outputText id="outtxt_existing_cars_header"
                                                    value="#{prassigngrp['pr.existingcars']}"
                                                    title=" #{prassigngrp['pr.existingcars']} "
                                                    style="font-size: 14px"/>
                                  </f:facet>
                                  <rich:column id="col_ap_row_num" width="25" style="font-size: 13px">
                                      <f:facet name="header">
                                          <h:outputText id="outtxt_ap_col_row_no_header" value="#"/>
                                      </f:facet>
                                      <h:outputText id="outtxt_ap_col_row_no" value="#{rkv+1}" />
                                  </rich:column>
                                  <rich:column id="col_ap_row_car_name" width="250" style="font-size: 13px">
                                      <f:facet name="header">
                                          <h:outputText value="Car Name"/>
                                      </f:facet>
                                      <h:outputText id="outtxt_car_name" value="#{row.car_name}"/>
                                  </rich:column>
                                  <rich:column id="col_ap_row_car_desc" width="350" style="font-size: 13px">
                                      <f:facet name="header">
                                          <h:outputText value="Car Description"/>
                                      </f:facet>
                                      <h:outputText id="outtxt_car_desc" value="#{row.car_desc}"/>
                                  </rich:column>
                                  <rich:column id="col_ap_row_car_sel" width="105" style="text-align: center">
                                      <f:facet name="header">
                                          <h:outputText value="Select Car"/>
                                      </f:facet>
                                      <rich:spacer height="1" width="30"/>
                                      <h:selectOneRadio id="rb_sel_existing_car">
                                          <f:selectItem/>
                                          <a4j:support event="onchange"
                                                       action="#{mybean.value_change_existing_car}"/>
                                      </h:selectOneRadio>
                                  </rich:column>
                              </rich:extendedDataTable>

       

      If there is something wrong then please let me know.

       

      Thanks in advance,

      JSF GEEKS

        • 1. Re: SelectOneRadio inside extendedDataTable not working properly
          ilya_shaikovsky

          Placing any select or input or the other component iniside the column means creation of the component for each row. So it will not work as single table select as you need. It will works the same for other tables and for standard h:dataTable.. Other libraries implements special selection control which specific to table and encoded by table as single component. unfortunatelly we have such functionality planned only for 4.x.

           

          Right now you could only reset state of all the other selects in value_change_existing_car action and reRender the table. And b.t.w. why you can't use just buit-in single selection which implemented by row highlighting?

          • 2. Re: SelectOneRadio inside extendedDataTable not working properly
            jsfgeeks

            Thanks for your support. I have changed it with a4j:commandButton for now.

             

            Thanks again for your time and support,

            JSF GEEKS