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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
hemant_sain
Posts: 106
Registered: ‎12-09-2011
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.

Please use plain text.
Developer
Zmey
Posts: 919
Registered: ‎12-18-2012

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.

 

Please use plain text.
Developer
hemant_sain
Posts: 106
Registered: ‎12-09-2011
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. :smileyhappy:

Please use plain text.