嗯,我只是想從列表視圖中選擇的值,並將其傳遞到下一個屏幕(頁面)。但我不能這樣做,因爲它表明類似的錯誤如何從級聯中獲取值級聯黑莓
asset:///main.qml:25: TypeError: Result of expression 'dataModel.model' [undefined] is not a function.
我下面這段代碼如下所示
此代碼是我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
}
]
}
此代碼是我第二頁Page2.qml,我想要從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
}
}
}
我對這個開發很陌生。
你有'進口bb.data 1.0'? –
@BojanKogoj yep ..我輸入了它。 – avipandey