Skip to Content
author's profile photo Former Member
Former Member

JSON Model Sorting

Dear All,

Could anyone give me an working example of sorting data in Json Model once received from Webservice URL.

I want to put a ascending sort on one of the columns.

Thank you.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jan 12, 2016 at 12:44 PM

    Hi Asif,

    If you want to manipulate your JSON data then by getting your data into an array and sorting that array should work for you.

    var arr = jsonModel.getData();

    If you want to bind your sorted data to a List or Table, I will suggest you to use "sorter" in Data Binding of your control.

    Let me know your exact requirement, So I can help you better.

    Cheers,

    KK

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2016 at 02:30 PM

    asif,

    you can sort in different ways.. one would be using the sorter as per KK suggestion. another option would be to use the javascript sorter or if you have an array of simple data type (int) then you could have arr.ArrayOfInts.sort() .

    further, if you have a table and you need to sort there, check out this

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2016 at 04:03 PM

    Guys,

    Thank you but i do not have a Table to bind context or Array to sort.

    I have Object List like this :

    - Items

    - _data

    - 0

    - id : a

    - group: 1

    - 1

    - id: b

    - group: 2

    - 2

    - id: c

    - group: 1

    All these are Objects list : Item is of Type Object, _data is of type object, 0 is of type object.

    I want to sort by GROUP.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.