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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 55
Registered: ‎12-04-2012
My Device: Q10
My Carrier: Verizon
Accepted Solution

Show only 1 line from an XmlDataModel?

Hi everyone! Smiley Happy

 

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 Smiley Happy

 

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

Regular Contributor
Posts: 77
Registered: ‎01-27-2010
My Device: Dev Alpha
My Carrier: Verizon

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

 

Highlighted
Developer
Posts: 55
Registered: ‎12-04-2012
My Device: Q10
My Carrier: Verizon

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 Smiley Wink