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
Highlighted
Developer
Posts: 614
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Assigning Unique IDs to Nested Repeater Components & Manipulating Dynamically Generated Components

Hello. I am using the Repeater Class (from https://github.com/blackberry/Cascades-Samples/tree/master/repeater) to make a grid of components. I need  to assign unique row and column IDs to descending Containers.

 

Like So. Here is a visual sketch.

 

// SCHEMA
// ---------------------------------------------------------------------------------------
// ROW1COL1      |     ROW1COL2     |     ROW1COL3     |     ROW1COL4     |     ROW1COL5
// ---------------------------------------------------------------------------------------
// ROW2COL1      |     ROW2COL2     |     ROW2COL3     |     ROW2COL4     |     ROW2COL5
// ---------------------------------------------------------------------------------------
// ROW3COL1      |     ROW3COL2     |     ROW3COL3     |     ROW3COL4     |     ROW3COL5
// ---------------------------------------------------------------------------------------
// ROW4COL1      |     ROW3COL2     |     ROW4COL3     |     ROW3COL4     |     ROW3COL5
// ---------------------------------------------------------------------------------------


//MY CODE
Container{
   id: allComponents
Repeater {
      // rows
       model: 4
       Container{
            //I WANT TO ASSIGN ROW ID HERE
            preferredWidth: 768
            preferredHeight: 200
            layout: StackLayout{
                orientation: LayoutOrientation.LeftToRight 
            }
            Repeater{
                //each column
                model: 5
                Container{
                    // I WANT TO ASSIGN ROWXCOLY ID HERE
                    preferredHeight: 200
                    preferredWidth: maxWidth
                    layoutProperties: StackLayoutProperties {
                         spaceQuota: 5
                    }
                    layout: DockLayout{}
                    Label{
                        text: "COL" + index
                    }
                }
            }
       }
    }
}
}//end allComponents

 

I will be modifying properties of various components within the Repeater container.

 

 

Question 1: How Do I assign the Unique IDs based on row & column?

See code snippet above

 

Question 2: Let's say I edit a property of ROW1COL2 during my application. How do I restore the properties of ROW1COL2 or all of the ROW/COL components inside the Repeater class? clear every property to its original form.

 

See code snippet above

 

Question 3: How do I determine if any number of rowcolumns have X property and then get their ID?

 

Query which Containers within allContainers have a background of Color.Black for example or to return container IDs that do not match the properties I'm looking for?


See code snippet above

 

 

I hope I'm making sense.

Thank you for your help.