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
Developer
Posts: 781
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Create a dynamic list

How can I create a dynamic list , read by json

 

 

import bb.cascades 1.0
  
Page {
    content: Container {
        ListView {
            dataModel: XmlDataModel {
                source: "models/items.xml"
            }
        }

}}

 

I dont want it this way.I want to read say  firstname/lastname/dob from json file and represent them in a table manner.
Developer
Posts: 540
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Create a dynamic list

[ Edited ]

Use GroupDataModel

// If your data is in the list, then you need just this in QML
var json = JSON.parse(jsonData)
for (var item in json){
    model.insert(json[item])
}

// Or just model.insertList(json)

 Hope it helps

PS: This will help you too https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/working_w...

 



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
BlackBerry Development Advisor
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: Create a dynamic list

Hi babakar,

 

Our Cascades-Samples repo on Github contains a few very useful sample apps that demo the use of json data in your app. You could checkout the following samples that I personally found very useful for explaing how to work with and parse json data:

 

https://github.com/blackberry/Cascades-Samples/tree/master/jsonreadwrite

https://github.com/blackberry/Cascades-Samples/tree/master/httptest

https://github.com/blackberry/Cascades-Samples/tree/master/mavenartifacts

 

There is also the bucketlist, the rssnews, the stampcollector and the weatherguesser sample apps that you could checkout for working with json data in your app.

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker