Im doing a list view with a XMLDatamodel and i trying to save data in my xml file because i want to keep safe this information after the aplication closes.
I just want to save the text on textarea in "body" of my xml file when the button below is clicked. or is better use a JSON file or a Arraydatamodel?
this is my QML file:
import bb.cascades 1.2
Page {
Container {
ListView {
dataModel: XmlDataModel {
source: "Data.xml"
}
listItemComponents: [
ListItemComponent {
Header {
title: ListItemData.title
}
},
ListItemComponent {
type: "body"
Label {
text: ListItemData.title
}
}
]
}
TextArea {
id: nameField
hintText: "Text To Save in body of XML file"
preferredHeight: 140
horizontalAlignment: HorizontalAlignment.Fill
}
Container {
horizontalAlignment: HorizontalAlignment.Center
Button {
text: "ADD"
onClicked: {
//SAVE THE TEXT IN TEXTAREA TO A DATA.XML
}
}//end of button
} // end of Container
}//end of container
}//end of page
And this is my XML File "Data.xml"
<root>
<header title="NOTE 1"/>
<listItem title="THIS IS A BODY OF NOTE 1"/>
<header title="NOTE 2"/>
<listItem title="THIS IS A BODY OF NOTE 2"/>
</root>
Please Help Me. Thank You So Much :D .