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
New Contributor
Posts: 5
Registered: ‎12-11-2012
My Device: Curve 9360
My Carrier: Att
Accepted Solution

How to change rootIndexPath with javascript

I would like to be able to change the value of rootIndexPath with javascript. Is this possible?

I can see the value of rootIndexPath with

Label{

text:"Root Index Path:" +listview.rootIndexPath;}

 

//but  I can't change the value. below is the code I am trying to fix

 

example:

 

Button{
text:"execute"
onClicked: {
listview.rootIndexPath=1;
}//end onClicked


}//end button


ListView {
rootIndexPath:[2]
id: listview
dataModel: XmlDataModel {
source: "simplelist.xml"
}//end dataModel

}//end listview

Highlighted
Developer
Posts: 77
Registered: ‎05-21-2012
My Device: DA C, Z10 LE, Passport
My Carrier: TIM

Re: How to change rootIndexPath with javascript

Have you tried with:

listview.rootIndexPath=[1];

alternatively tou can try with:

var tmp = rootIndexPath;
tmp[0] = 1;
rootIndexPath = tmp;

 or maybe with:

listview.setRootIndexPath( [1] );

 let me know

New Contributor
Posts: 5
Registered: ‎12-11-2012
My Device: Curve 9360
My Carrier: Att

Re: How to change rootIndexPath with javascript

That worked: it needed to be set as an array value. Thanks

listview.rootIndexPath=[1]