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
citrinetiger
Posts: 55
Registered: ‎12-04-2012
My Device: Q10
Accepted Solution

Show only 1 line from an XmlDataModel?

Hi everyone! :smileyhappy:

 

I have tried to figure this out on my own but I cant seem to get it. Please take a look, its probably something simple that I am missing. Thanks!

 

-Ali

 

I apologize in advance for not knowing how to add code snippets in the message box. If someone could tell me how I will edit it :smileyhappy:

 

How in the world do I make a list where I specify what line from the XmlDataModel I want to show?

 

 ****here is the XmlDataModel(fruitmodel.xml)

Photobucket

 

****here is the main.qml***

Photobucket

 

and finally my Item list(FruitListItem.qml)

 

Photobucket

Please use plain text.
Regular Contributor
mazmellow
Posts: 77
Registered: ‎01-27-2010
My Device: Dev Alpha

Re: Show only 1 line from an XmlDataModel?

Hi citrinetiger,

 

I'm new in this platform. But I think, you must modify your xml from

<root>
      <101  name="...."  ....>

      <102  name="...."  ....>

      <103  name="...."  ....>

      ....
</root>

to

<root>
      <item  what="101"  name="...."  ....>

      <item  what="102"  name="...."  ....>

      <item  what="103"  name="...."  ....>

      ....
</root>

As you can see, I add tag "item" and an attribute "what" for each number 101,102,...

 

and then, I modify your ListItemComponent like this

ListItemComponent {

          type: "item"

          FruitListItem {

                      visible: {

                              if (ListItemData.what == "104") {

                                       return true;                                 // For show only 104

                              } else {

                                       return false;

                              }

                     }
           }
}



Maz

 

Please use plain text.
Developer
citrinetiger
Posts: 55
Registered: ‎12-04-2012
My Device: Q10

Re: Show only 1 line from an XmlDataModel?

Thank you so much!!! I have been getting a headache over this for the past 2 days and your suggestion worked like a charm :smileywink:

Please use plain text.