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: 259
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil
Accepted Solution

sortedAscending without sortingKeys doesn't work

I want to reorder my ListView. It's now just the opposite of how it should be. This is how I have:

 

GroupDataModel {
     id: fromDataModel
     grouping: ItemGrouping.None
     sortedAscending: true
},

 But this doesn't work. It doesn't matter, unless sortingKeys is present, sortedAscending has no influence.

I don't want sortingKeys, since I only have one thing in the list, and I want it to be ordered as I received it.

 

 

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: sortedAscending without sortingKeys doesn't work

I'm sorry to say this doesn't make sense to me. If you have only "one thing in the list" (i.e. a single item in your data model), then the concept of sorting doesn't apply. Sorting is a way of arranging multiple items in some ordered sequence.

Can you please clarify what it is you're trying to do?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 259
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil

Re: sortedAscending without sortingKeys doesn't work

I get 9 city names from web service, and they are ordered by size. Name is all I get, so if I use sortingKeys: [ "city" ] I loose that order. When I put it to ListView it is from smallest to largest, and I want to turn it around.

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: sortedAscending without sortingKeys doesn't work

I suggest replacing GroupDataModel with ArrayDataModel. It can also store a list of maps, but doesn't rearrange it's entries.

Andrey Fidrya, @zmeyc on twitter
Highlighted
Developer
Posts: 259
Registered: ‎01-08-2013
My Device: Z10 LE
My Carrier: SiMobil

Re: sortedAscending without sortingKeys doesn't work

Yup, that is way better solution. Thanks