jQuery UI Widgets Forums Grid Nested JSON – Array inside

Tagged: , , , ,

This topic contains 5 replies, has 2 voices, and was last updated by  Dimitar 12 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Nested JSON – Array inside #14313

    mpawlows
    Member

    hello,

    I know that there is possibility to access nested JSON like this: schedule>scheduleDay>scheduleHour

    but my question is.. what if scheduleDay is an Array? I can access SINGLE value like this: schedule>scheduleDay>0>scheduleHour and it is okay, where 0 is ofcourse an index of array but my question is: is there any possibility to fetch all records for example from 0 to 10?
    how to get access to the WHOLE array?

    Thank You for reply

    cheers, Matthew

    Nested JSON – Array inside #14318

    Dimitar
    Participant

    Hello Matthew,

    Please check out the Grid Data Sources documentation entry. There you can find information about the root source property, which describes where the data begins and all other loops begin from this element.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Nested JSON – Array inside #14374

    mpawlows
    Member

    First of all, thank You for the fast response. Good to know that You support Your product community 🙂 (forgive me my english, not my native)

    Yes obviously I’ve read the doc but I didnt understood it very well. I know I just need to get the idea so maybe You could clearly explain me on my simple example. Lets say that I have a Json with this hierarchy:

    schedule –
    |
    |-> scheduleId = 8
    year = 2012
    scheduleDayses –
    |
    |-> 0
    1
    2
    |
    |-> scheduleDayId = 2
    day = 17
    scheduleHours –
    |-> 0
    1 –
    |->
    scheduleHourId = 1
    hour = 15:00

    so there are 2 arrays: scheduleHours nested in scheduleDay ( 2 elements) and scheduleDays array nested in schedule (3 elements).

    Could you, please, paste me code with {name: “” map:” … > … > … >”} and root: “” filled in? Because I have completly no idea how to fits this into mapping and after that which element need to be found in root attribute. Thank You very much for reply!

    Nested JSON – Array inside #14403

    Dimitar
    Participant

    Hi Matthew,

    Could you, please, provide us with an actual JSON code so that we may better be able to help you?

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Nested JSON – Array inside #14433

    mpawlows
    Member

    http://i46.tinypic.com/314axyw.jpg

    please see this link, there You have a prtscreen from firebug showing the json message hierarchy. What I am asking for are those three elements and getting access to them. I can access schedule hours by mapping schedule>scheduleDayses>0>schedulehourses>0 but I am getting access only for the 0 element (0 is an example ofcourse it also works next array elements) but what I want is to call whole array elements in this case scheduledayses from 0 to 2 and schedulehourses from 0 to 1. Please post me a code how to do it ( I mean those { “field_name” map: “mapping>mapping”} and what value is in root: “value” attribute.

    Thanks for help, I really appriciate it.

    Nested JSON – Array inside #14481

    Dimitar
    Participant

    Hi Matthew,

    Here is how the mapping is supposed to be, having in mind the information provided:

    datafields: [
    { name: 'schedule' },
    { name: 'scheduleDayses', map: 'schedule>scheduleDayses' },
    { name: 'scheduleHourses', map: 'schedule>scheduleDayses>0>scheduleHourses' },
    ],

    If it still does not work, please provide us with the actual JSON code.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.