firebase-as3 icon indicating copy to clipboard operation
firebase-as3 copied to clipboard

Sort

Open sfxworks opened this issue 8 years ago • 1 comments

Do all of these methods work? https://firebase.google.com/docs/database/rest/retrieve-data

I am trying to order my data alphabetically. After I turn my data into an Object I can't turn it into an array and sort it.

var sorted:Array = e.data //JSON.parse result
sorted.sortOn("1");

I saw that REST isn't able to keep list items at order either. I want to sort all the items I get from a JSON node alphanumerically.

sfxworks avatar Jun 21 '17 13:06 sfxworks

You are correct, Firebase always returns the data scrambled and you are required to sort it in client side.

Please take a look at this function, it shows you how you can recursively convert the JSON into an Array, sort it and pass it to a data provider.

agentphantom avatar Jun 21 '17 13:06 agentphantom