2 Replies Latest reply on Aug 3, 2011 9:51 PM by FahaAK

    Referring only one row depending upon the checkbox checked using inline itemrenderer

    FahaAK

      Hi All...,

       

      I have a little misunderstanding about  inline itemrenderers, as i mentioned earlier im new to flex please  pardon me if this is a silly question..

      Question:

      I have an Advanceddatagrid, i have added a column of checkboxes usint inline itemrendered:

      <itemrenderer = mx.controls.CheckBox">

      i have the column defined as select i.e....

      <AdvancedDatagridColumn id="select" itemrenderer="mx.controls.CheckBox">

      i have a series of columns following this above column...i want to be able to select a particular row

      upon the selection of the checkbox....i however doubt that im selecting the column("select") and not an individual

      checkbox....

      Or in better words "Is there a way where i can reference to these checkboxes individually" as im intending to do

      some data inserting,deleting and updating activity depending upon the selected checkbox...

      However i also intend to open another MXML file that contains only that data that is checked by the checkbox...

      I request you experts to help me out with this....

      Im trying to do this from 2 days now...., please  help me out....

      Thanks all in advance

        • 1. Re: Referring only one row depending upon the checkbox checked using inline itemrenderer
          Nishant Jha28 Level 2

          Lets break the problem statement in multiple steps

           

          1. We need a way to know the selection on all rows.

          2. We need the association of the checkBox with the data

           

          The solution is to use a arrayCollection/array that holds all the instances created for checkbox.This collection should be a property of component containing the datagrid. We need to use a custom component implementation or inline ItemRenderer. The way you have used is called dropinItemRenderer. Preferaly use custom component implementation and add the instance to the arrayCollection at CreationComplete. Make sure you use addItemAt so that you add the instance in the same row as the data. To get rowIndex the custom Checkbox should implement IDropInListItemRenderer. You could iterate this collection to check all the instances that are checked.

           

          Note: This is the approach considering your dataprovider doesnt have a selection field.

           

          Nishant

          1 person found this helpful
          • 2. Re: Referring only one row depending upon the checkbox checked using inline itemrenderer
            FahaAK Level 1

            Hi Nishant

             

            Thanks for the reply....,i guess this is quite what i should be doing...it would be of great help if you could

            post a code snippet or atleast refer a link where i can see how this done considering the fact that im totally new to flex...,

            Thanks in advance again..

            faha