How to Prevent Mobiscroll from Sorting Custom Wheels

83 views
Skip to first unread message

Greg Stavenow

unread,
Apr 17, 2013, 10:29:40 PM4/17/13
to mobis...@googlegroups.com
I have populated a custom wheel with the values that I want in the order that I want, but when the wheel is displayed the items are in alphabetical order.  How can I tell mobiscroll (I'm using version 2.4.4) to just use the list in the order that it is already in?

For example, this is what the data looks like:

{"2":"Dog"
,"1":"Cat", ....}

But the wheel is displayed in this order:

Cat
Dog
....


Istvan Halmen

unread,
Apr 18, 2013, 2:11:23 AM4/18/13
to Mobiscroll Group
The problem is that the keys are numbers, and unfortunately in the object  the order is not kept. One possible workaround is to use strings, like:
{ "_2": "Dog", "_1": "Cat" }
With this solution the order is kept, but you need to write your own parseValue and formatResult function which takes care of the extra "_" character.
This technique is used in the mobiscroll select component.


--
You received this message because you are subscribed to the Google Groups "Mobiscroll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobiscroll+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Greg Stavenow

unread,
Apr 19, 2013, 4:17:09 PM4/19/13
to mobis...@googlegroups.com
Thanks for the info Istvan.  That approach does indeed solve the sorting issue.  It does not seem like an optimal solution though.  Do you think the mobiscroll framework will be updated in a future release so that the list order is left alone and this workaround is no longer required?
Reply all
Reply to author
Forward
0 new messages