Well I am just trying to get the value from the list-view on selection and pass it to the next screen(page). But I am unable to do as it shows error like
asset:///main.qml:25: TypeError: Result of expression 'dataModel.model' [undefined] is not a function.
My following piece of code is as follows
This code is of my main.qml
NavigationPane
{
id:navi
Page
{
Container
{
background: Color.Transparent
topMargin:2.0
TextField {
id: lb1
text:""
}
ListView
{
topMargin: 2.0
dataModel: XmlDataModel { source: "model.xml" }
onTriggered: {
console.log("onTriggered");
// Retrieve the selected item
var selectedItem = dataModel.data(indexPath);
lb1.text = selectedItem.status;
pushed.lb2.text="You Selected :" + lb1.text;
navi.push(pushed)
}
}
}
}
attachedObjects: [
Page2 {
id: pushed
}
]
}
This code is of my second page Page2.qml, where I want to retrieve the info from the main.qml
import bb.cascades 1.0
Page {
property alias lb2: lb2
Container {
horizontalAlignment: HorizontalAlignment.Center
Label {
id:lb2
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
text: "You Selected :" + lb1
}
}
}
I am new to this development.