Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor
Accepted Solution

Checkbox as list Item component

Hi,

I have created a ListView with list item components as a label and a checkbox. 

When I check the checkbox on a list item, I will not get a onTrigger event from the list.  So, there is no way to see if the check box is checked or unchecked.  I need only one checkbox to be in "checked" state in the listview at a time. 

 

I tried to get the indexpath of the checkbox which is checked, and call a function to iterate through the index path. There I want to uncheck all the checkboxes other than the one which is checked now. 

CheckBox {
               id: checkBoxId
               horizontalAlignment: HorizontalAlignment.Right
               verticalAlignment: VerticalAlignment.Center
                onCheckedChanged: {
                 var rowNum = rootContainer.ListItem.indexPath;
                 count = articlesDataModel.size();
                  toggleCheckBox();
                                   }
          }
                              
            function toggleCheckBox()
                    {
                      for (var i=0 ; i< count ; i++) 
                       {
                        if(rootContainer.ListItem.indexPath[i]!= rowNum)
                         {
                          ????????
                          }
                                        
                         }
                                    
                      }  

 this is the code I tried. But, I dont know how to get the checkbox control here inside.. Smiley Sad 

 

Could someone please look into this? 

 

Thanks,

SJ

Please like this if you are answered.
Developer
Posts: 24
Registered: ‎10-31-2012
My Device: Dev Alpha B
My Carrier: COMPE

Re: Checkbox as list Item component

You can save the checkbox status in list so when the item is clicked you get the indexPath and check the checkbox.
__
Helped you? Like me.
Developer
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: Checkbox as list Item component

hi..

 

http://supportforums.blackberry.com/t5/Cascades-Development/radiobutton-in-list-view-problem/td-p/24...

this link helped me to solve this. Thanks Smiley Happy

Please like this if you are answered.