목록보기 항목을 편집하려고하는데 지금 생성 한 json 파일을 채우는 목록보기가 성공적으로 작성되었습니다. 하지만 문제가 생기면 계속 오류가 발생합니다. TypeError : 'curData'[undefined] 표현식의 결과가 객체가 아닙니다. 아래는 샘플 코드이며, 페이지가 생성 된 후리스트 뷰를 편집하려고합니다. 블랙 베리 캐스케이드의 목록 항목 편집 QML
이
내가 목록보기를로드 페이지입니다import bb.system 1.0
import bb.cascades 1.0
import bb.data 1.0
import Network.Communication 1.0
Page {
Container {
id: profilePage
layout: DockLayout {
}
ListView {
id: profileListView
dataModel: contactsData
listItemComponents: [
ListItemComponent {
id: myItem
type: "item"
CustomListItemProfilePage {
id: listCell
background: Color.create(ListItemData.color)
text: ListItemData.name
onClicked: {
console.log(listCell.text);
}
}
}
]
onTriggered: {
}
}
}
onCreationCompleted:
{
var curData = contactsData.data([0,0])
curData.name = curData.name + " : "+ _settings.getValueFor("loginUserName", "No login name");
contactsData.updateItem([0,0],curData)
console.log("on compleete LOADED:"+contactsData.data([0,0]).toString());
profileDataSource.load();
}
attachedObjects: [
GroupDataModel {
id: contactsData
sortingKeys: ["order"]
grouping: ItemGrouping.None
},
DataSource {
id: profileDataSource
source: "asset:///Model/ProfileDetails.json"
onDataLoaded: {
contactsData.clear();
contactsData.insertList(data);
}
onError: {
console.log("JSON Load Error: [" + errorType + "]: " + errorMessage);
}
}
]
}
이 내 샘플 JSON 파일입니다. 내가 _settings.getValueFor에 저장되어 로그인 후 얻을 실제 이름과 텍스트 이름을 대체하기 위해 노력하고있어 ("loginUserName는", "아니오 로그인 이름은")
[
{ "order": 1, "name": "NAME" ,"color":"#16A085" },
{ "order": 2, "name": "FIND FRIENDS" ,"color":"#2ECC71" },
{ "order": 3, "name": "INVITE" ,"color":"#3498DB" },
{ "order": 4, "name": "EDIT PROFILE" ,"color":"#34495E" }
]
이 내 목록보기 항목에 대한 QML 없다
import bb.cascades 1.0
import QtQuick 1.0
import "Model/floatConstants.js" as Item
Container {
property alias text: label.text
property TextStyleDefinition textColor:label.textStyle
signal clicked()
layout: DockLayout {
}
preferredHeight: Item.itemHeight
preferredWidth: 1000.0
Container {
background: Color.Transparent
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
Label {
id: label
text: "demo"
textStyle {
base: textColor.style
}
}
gestureHandlers: [
TapHandler {
onTapped: {
clicked();
}
}
]
}
}
}
저는 블랙 베리에 처음 왔고 이것은 제 첫 번째 블랙 베리 프로젝트입니다. 이것이 가능한지 또는이를 달성 할 다른 방법이 있는지 알려주십시오. 이것
profileDataSource.load()를로드 한 후에 curData를 설정하려고했지만 여전히 동일한 오류가 표시됩니다. Bojan을 제안하는 다른 방법은 무엇입니까? – Gamerlegend