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
pushkaraj9009
Posts: 72
Registered: ‎06-20-2013
My Carrier: idea

Re: dynamic dropdown

hello,

i have populated the dropdown using a xml file...i used a xmlreader class for this...but now i have two dropdowns in the same ui...how to set options to the second dropdown using the same xml file.....is it possible???

 

Thanks

 

Please use plain text.
Contributor
jeetak47
Posts: 13
Registered: ‎10-05-2012
My Carrier: BSNL

Re: dynamic dropdown

it is possible in QML  ...

 

1) get values whatever source you have (array of value that ).

 

2) create ComponentDefination with Option  root element source qml

 

3) write bellow piece  suppose  elements is  array of values, optionComp is component definition , and dd is ur dropdown

 

dd.removeAll();

for(var i=0;i<elements.length;i++){

var  optionelement = optionComp.createObect();

optionelement.text=elements[i];
optionelement.value=elements[i];

dd.add(optionelement);

}

 

 

Please use plain text.
Developer
pushkaraj9009
Posts: 72
Registered: ‎06-20-2013
My Carrier: idea

Re: dynamic dropdown

i have done similar thing for adding options to first dropdown.....but when i add similar type of code to add options to 2nd dropdown,it just gives me the blank dropdown....i used another xml file for 2nd dropdown and fetched it in qml like this

 

var xmlContents = XML.LoadXML("Information.xml", "object", "description");

var xmlContents1 = XML.LoadXML("abc.xml", "object", "description");

 

Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: dynamic dropdown

i would suggest that you mark this thread as solved and ask new questions in a new one.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
pushkaraj9009
Posts: 72
Registered: ‎06-20-2013
My Carrier: idea

Re: dynamic dropdown

I got the solution finally....added data for 2nd dropdown in the same xml with a different row type...and now with a simple for loop im able to populate the 2nd dropdown too.....

Please use plain text.