jQWidgets Forums

jQuery UI Widgets Forums Grid How to render nested json objects in a grid

This topic contains 2 replies, has 2 voices, and was last updated by  josh 11 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • josh
    Participant

    Hi,
    I have this json data that i want to render to a grid,
    var data = [
    {
    “pk”: 1,
    “model”: “artefacts.eventgroup”,
    “fields”: {
    “groupname”: “Failed login”,
    “event”: {
    “pk”: 1,
    “model”: “artefacts.event”,
    “fields”: {
    “event_id”: 2345,
    “windows”: “Win 2008”
    }
    }
    }
    },
    {
    “pk”: 2,
    “model”: “artefacts.eventgroup”,
    “fields”: {
    “groupname”: “unauthenticated user “,
    “event”: {
    “pk”: 1,
    “model”: “artefacts.event”,
    “fields”: {
    “event_id”: 2345,
    “windows”: “Win 2008”
    }
    }
    }
    },
    {
    “pk”: 3,
    “model”: “artefacts.eventgroup”,
    “fields”: {
    “groupname”: “wrong username”,
    “event”: {
    “pk”: 2,
    “model”: “artefacts.event”,
    “fields”: {
    “event_id”: 2345,
    “windows”: “Win 2007”
    }
    }
    }
    },
    {
    “pk”: 4,
    “model”: “artefacts.eventgroup”,
    “fields”: {
    “groupname”: “wrong password”,
    “event”: {
    “pk”: 3,
    “model”: “artefacts.event”,
    “fields”: {
    “event_id”: 3456,
    “windows”: “Win 2003”
    }
    }
    }
    }
    ];
    As you can see, the fields windows and event_id are at level two..how do i possibly render them to grid?


    Peter Stoev
    Keymaster

    Hi josh,

    To render nested JSON objects, you should set the “map” member of the source object’s data fields. To learn how to do that, please look at: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    josh
    Participant

    Thanks Peter Got it

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

You must be logged in to reply to this topic.