1 Reply Latest reply on Aug 16, 2011 4:08 AM by hidarikani

    RadioButton in AdvanceDataGrid sometimes get selected, sometimes not

    HazwanRR Level 1

      Hi,

       

      I have an item renderer for my datagrid which happens to be the radio button. The radio button works fine selecting and unselect rows in the datagrid. It can also save the row selected but when I want to populate back the selection from database, sometimes it displays the selected radiobutton well, but sometimes none is selected eventhough I have the slected value in my database. Why is that happening? Any advise?

       

      Thanks

        • 1. Re: RadioButton in AdvanceDataGrid sometimes get selected, sometimes not
          hidarikani Level 2

          Item renderers are reused for performance reasons: if you have a data provider with 1000 rows the data grid won't create 1000 item renderers.

          For example you check a check box that belongs to an item renderer which displays data row A but after scrolling/expanding/contracting the same item renderer might be used for data row B.

           

          To solve this problem store the check box state in the data provider and bind to it:

          <s:CheckBox id="checkBox"
               selected="{isChecked(listData)}"
               change="checkBox_changeHandler(event)"/>
          

          1 person found this helpful