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

Reply
Highlighted
Developer
Posts: 610
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.