Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
Ooata
Posts: 10
Registered: ‎01-14-2013
My Device: Blackberry 10 Simulator

DataSource object with xml file

Hi, following on from a previous thread of mine regarding using an xml file with child elements in a list view, I am having great difficulty in implementing the solution of using a groupdatamodel with a datasource.

 

I have an xml file with the following stucture

 

<data success="1" status="200">
	<item>
		<id>Cot4g</id>
		<title>So someone posted a split pic earlier</title>
	</item>
	<item>
		<id>Xz56B</id>
		<title>Shower this man in Karma</title>
        </item>
</data>

 I am trying to populate a list view with the information and the examples I am following just aren't working for me. Each <item> will populate the listview but I cant seem to get the code working. Can anyone give me a hand in implementing this? 

New Developer
MaxxJag
Posts: 78
Registered: ‎04-17-2011
My Device: BlackBerry Z10 LE

Re: DataSource object with xml file

https://developer.blackberry.com/cascades/reference/bb__cascades__xmldatamodel.html

This is what you should be using, not groupdatamodel.

 

Example is ok, I prefer

https://developer.blackberry.com/cascades/documentation/ui/lists/xmldatamodel.html

MaxxWares.com
Current apps:
-BBOS 10-
MaxxTransit - Coming soon
New Developer
Ooata
Posts: 10
Registered: ‎01-14-2013
My Device: Blackberry 10 Simulator

Re: DataSource object with xml file

The problem I've had with that is that it doesn't work with the format of the xml file I have. It needs to use attributes rather than child elements. I was directed to use a DataSource and GroupDataModel as they can handle xml files with child elements.

New Developer
MaxxJag
Posts: 78
Registered: ‎04-17-2011
My Device: BlackBerry Z10 LE

Re: DataSource object with xml file

I'll need your code to know. I've had lots of fun with GroupDataModels so hopefully i can help.

MaxxWares.com
Current apps:
-BBOS 10-
MaxxTransit - Coming soon
Developer
taylortbb
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook

Re: DataSource object with xml file

Try with an ArrayDataModel. I've found the GroupDataModel + DataSource combo to be less than reliable. Unless there's some reason you need the grouping feature? Just remember that insertList(data) becomes append(data).

--------
Taylor Byrnes