If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
j_ind
Posts: 6
Registered: ‎09-14-2013
My Device: Blackberry Dev Alpha B
My Carrier: Airtel
Accepted Solution

Navigating through pages

Hi,

I am creating a native app which has a list of items. When an item is selected , it must be navigates to a particular page.I couldn't navigate to another page. Please help me with code to navigate pages. The following is my code.

 

 

import bb.cascades 1.0
NavigationPane {
id:head

Page {
content: Container {
ImageView {

}
ListView {
dataModel: XmlDataModel {
source: "items.xml"
}
listItemComponents: [
ListItemComponent {
type: "header"
Header {

title: ListItemData.title
subtitle: ListItemData.subtitle
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center

}
},
ListItemComponent {
type: "listItem"
StandardListItem {
title: ListItemData.title
description: ListItemData.subtitle
status: ListItemData.status
imageSource: ListItemData.imagepath

}
}
]
onTriggered: {
var selectedItem=dataModel.data(indexPath);
navigateTo(one)

}
}

}
}
attachedObjects:[
Page {
id:smileysurprised:ne
Container {
Label {
text: "Pineapple Honey Bee"
}
ImageView {
imageSource: "asset:///1.jpg"
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center

}
}
}
]
}

Please use plain text.
Developer
BBSJdev
Posts: 6,015
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: Navigating through pages

[ Edited ]

Within the onTriggered slot you would just push your page...

 

ListView {

    [ ... ]

    onTriggered: {  
        var selected = dataModel.data(indexPath);
        if (selected == "returned item") { var page = pageDefinition.createObject(); head.push(page);         } } attachedObjects: [ ComponentDefinition { id: pageDefinition source: "MyPage.qml" } ] }

 

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
BBSJdev
Posts: 6,015
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: Navigating through pages

If you want to push a page for each ListView item then I suggest you take a look at the Cookbook sample which uses dynamic loading to do exactly that.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
BBSJdev
Posts: 6,015
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: Navigating through pages

@j-ind, I noticed you haven't closed off any of your previous threads or hit the like button please get used to doing this as it is a common courtesy for those that help you and marking a thread as solved helps others with the same problem as you find the solution later. Thanks and welcome to the forums.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
New Contributor
j_ind
Posts: 6
Registered: ‎09-14-2013
My Device: Blackberry Dev Alpha B
My Carrier: Airtel

Re: Navigating through pages

Thank you so much BBJSDEV. Soryy for late reply, i could connect to internet.  :-)

Please use plain text.
New Contributor
j_ind
Posts: 6
Registered: ‎09-14-2013
My Device: Blackberry Dev Alpha B
My Carrier: Airtel

Re: Navigating through pages

Thanks a lot BBSJdev. This solved my problem. And sorry for replying you late. 

Please use plain text.