5 Replies Latest reply on Jun 15, 2012 6:12 AM by vincent.racaza

    Spark Datagrid with Checkbox

    vincent.racaza

      Hi. I have a question.

       

      In this example made by haru.... in this link...

       

      http://blogs.adobe.com/aharui/2011/03/spark-checkbox-datagrid-with-drag-and-drop-support.h tml

       

      Do you have any idea how to change some of the codes? Like if I click on the row, it will just highlight but it won`t check the checkbox. Selected index is the row being clicked. The checkbox should only be checked if he clicks the checkbox, not selecting the row....

       

      If he clicks one by one on the row, selected index will be the row being selected but checkbox will not checked.

       

       

      Please help me! I am just a newbie here... Please Please!

       

      Thanks!

        • 1. Re: Spark Datagrid with Checkbox
          tinylion_uk Level 2

          In this case the use would need to a, select the row in the grid, then go to the checkbox a select it

           

           

           

          If you want the selection of a row to also automatically set the checkbox to ticked you could just listen for a grid click event, use the info from the event to get the row click, then set the data that is bound to the checkbox for that row to ture and the box with then be ticked.

           

           

           

          If you are doing this because you need multi row selection then rather than having a tick box just set the datagrid to allow multiRow Selection

           

           

           

          <s:DataGrid doubleClickEnabled="true"

           

           

           

          Then rather than looking at the selectedIndex  use the selectedItems property and that will hold a vector or selected rows

           

           

           

          The user just uses CTRL Click to select multipule rows rather than just a mouse click.  You can in fact either use CTRL Click to select one row then another, or SHIFT click to select all rows between the first and second selections

          • 2. Re: Spark Datagrid with Checkbox
            vincent.racaza Level 1

            Hi! Thanks for the response.

             

            But that`s not what I mean.

             

            In the link that I post above. When you click a row in the datagrid(in any column you click), the checkbox will automatically be clicked. But what I want is, if he clicks another column other than the checkbox column, then, the checkbox will not click. It will just select the row.

             

            The checkbox for every row will just be checked if he clicks the checkbox column itself, not the other columns. And then, the checked checkboxes will be added to datagrid selected items.

            • 3. Re: Spark Datagrid with Checkbox
              tinylion_uk Level 2

              Arrrr ok. I get you. So you only want the check box to select when you click the check box column.

               

               

               

              I will download the demo source and take a look for you.

               

               

               

              Bear with me. It may be tonight but it may be tomorrow before I can take a look

               

               

               

              My email. glenn@tinylion.co.uk if you want to contact me off forum.

               

               

               

              Glad to be of help if I can

              • 4. Re: Spark Datagrid with Checkbox
                vincent.racaza Level 1

                Thank you very much..

                 

                 

                 

                I hope you can help me.

                • 5. Re: Spark Datagrid with Checkbox
                  vincent.racaza Level 1

                  HI!

                   

                  This is a perfect example....

                   

                  http://blogs.adobe.com/aharui/2010/01/checkboxes_in_datagrid_with_ch.html

                   

                  I need that functionality in my datagrid with checkbox.

                  But this example uses an mx datagrid. So, I want this functionality in a spark datagrid.

                   

                  Thanks.