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
Developer
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10
My Carrier: Aircel
Accepted Solution

How to Add the one container in another more than once in qml.

Hi all,

 

I want to add the one container in another container more than one time and the no of times will be changed according to requirement. I am trying to add the container using JavaScript but it is not working. I want to do this in qml not in cpp.

 

Please provide suggestion for this.

 

Thanks in advance.

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to Add the one container in another more than once in qml.

You can use ComponentDefinition to declare the component which you want to clone:

https://developer.blackberry.com/cascades/documentation/dev/dynamic_qml/

Then create it using .createObject and .add to first container multiple times in a for loop.

 

Another way is creating a ListView and manipulating it's dataModel to create a required number of items.

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10
My Carrier: Aircel

Re: How to Add the one container in another more than once in qml.

Thanks Zmey,

 

It is working for me thanks for your suggestion. Smiley Happy