01-11-2013 02:49 PM
I'm loading XML into a ListView and no matter what, it's coming in in the reverse order of which it is listed. Here's my code (with personal website removed)... anyone have any ideas how to change the order back to the way it's originally listed?
import bb.cascades 1.0
import bb.data 1.0
Page {
content: ListView {
id: myListView
dataModel: dataModel
listItemComponents: [
ListItemComponent {
type: "item"
StandardListItem {
title: ListItemData.test
}
}
]
}
attachedObjects: [
GroupDataModel {
id: dataModel
},
DataSource {
id: dataSource
source: "http://testdata.com/test.xml"
query: "root/test"
onDataLoaded: {
dataModel.insertList(data);
}
}
]
onCreationCompleted: { dataSource.load(); }
}
I can't use sortingKeys because I need the XML to come in the way it's listed, which isn't sortable. I tried using sortedAscending: false/true and it didn't change the order.
Thank you!
01-25-2013 02:45 AM
Hi Loomist,
I am also facing the same issue right now. Did u found its solution?? Can you please share it.
Thanks in advance.
01-29-2013 09:53 PM
Likewise I have the exact same problem described by Loomist.
01-29-2013 10:06 PM - edited 01-29-2013 10:06 PM
I still haven't found a solution to this problem. I have actually set aside the app that is requiring this, because it's just too big of an issue and I won't submit an app with such a glaring problem. I'm guessing it might be a bug in the XML handling if others are having this issue.
01-29-2013 10:08 PM - edited 01-29-2013 10:09 PM
I'm getting the issue using JSON data. The problem is probably internal to GroupDataModel (unless we're using it incorrectly).
02-11-2013 10:08 PM
Hi all,
Try using an ArrayDataModel instead of a GroupDataModel. A GroupDataModel is designed to sort your data automatically, while an ArrayDataModel allows you to arrange the data in the order you want (including to leave it as is). Also, use the append() function instead of the insert().
For more information on the ArrayDataModel class, check this link: https://developer.blackberry.com/cascades/referenc
Samar Abdelsayed - Application Development Consultant - BlackBerry
Did this answer your quetion? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
02-12-2013 06:02 AM
Hi Samar,
I tried your solution and it works fine.When trying to delete items it do so from the listview and xml when there is more than one item in the list.
But when there exist only a single item in the list, deleting it removes data from xml but doesnt reflect the change in the listview even if I have given datasource.load(); to make the changes effective.
Please, Help me out ot find a solution