blackberryblackberry-10blackberry-cascades

json array listview in blackberry cascades


1.Array Type

{"DATA":
[
{"CategoryID":"3","CategoryName":"News","CountryID":"1","Result":"OK"},
{"CategoryID":"4","CategoryName":"Daily Paper","CountryID":"1","Result":"OK"},
{"CategoryID":"5","CategoryName":"Thanthi","CountryID":"1","Result":"OK"},
{"CategoryID":"1","CategoryName":"Newspaper","CountryID":"1","Result":"OK"},
{"CategoryID":"2","CategoryName":"Magazine","CountryID":"1","Result":"OK"}
]
}

2.Direct Type

[
{"CategoryID":"3","CategoryName":"News","CountryID":"1","Result":"OK"},
{"CategoryID":"4","CategoryName":"Daily Paper","CountryID":"1","Result":"OK"},
{"CategoryID":"5","CategoryName":"Thanthi","CountryID":"1","Result":"OK"},
{"CategoryID":"1","CategoryName":"Newspaper","CountryID":"1","Result":"OK"},
{"CategoryID":"2","CategoryName":"Magazine","CountryID":"1","Result":"OK"}
]

for direct type declaration --->

 ListItemComponent {
     type: "listItem"
     StandardListItem {
         title: ListItemData.CategoryName
     }
 }

my question is how to declare title: ListItemData.??????? for first json array model


Solution

  • try this

    ListItemComponent {
     type: "listItem"
     StandardListItem {
     title: ListItemData.DATA[0].CategoryName
     }
     }