01-12-2013 08:36 AM
HI all,
I would like to know how to sort a list that is filled with an XML (form assets).
This is the code:
import bb.cascades 1.0
import bb.data 1.0
import "Common"
NavigationPane {
id: nav
peekEnabled: true
Page {
Container {
layout: StackLayout {
}
Label {
horizontalAlignment: HorizontalAlignment.Center
text: "text"
textStyle.base: textStyleBoldBig.style
id: labelTest
}
Container {
topPadding: 5
bottomPadding: topPadding
ListView {
id: countriesList
dataModel: XmlDataModel {
source: "models/countries.xml"
}
listItemComponents: [
ListItemComponent {
type: "country"
CountryItem {
}
}
]
onTriggered: {
var chosenItem = dataModel.data(indexPath);
var contentPage = phoneListDefinition.createObject();
var modelFile = chosenItem.file;
if (! modelFile) {
modelFile = "models/countries/" + chosenItem.name.toLowerCase() + ".xml";
}
contentPage.listDataModel.source = modelFile;
nav.push(contentPage);
}
layout: FlowListLayout {
orientation: LayoutOrientation.TopToBottom
headerMode: ListHeaderMode.Standard
}
}
} // End list Container
} //End main Container
} // End Page
attachedObjects: [
ComponentDefinition {
id: phoneListDefinition
source: "PhoneList.qml"
}
]
}
Thanks!
01-12-2013 12:06 PM
Use sorting keys in the GroupDataModel of ListView. https://developer.blackberry.com/cascades/referenc