jQuery UI Widgets Forums Grid JSON Parsing in Grid

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 9 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • JSON Parsing in Grid #74093

    prbvnky
    Participant

    How do I map below JSON ” indocs ” to single cell in the grid, sometimes it has just one object and sometimes it has array of objects? Thanks for your help!

    {
    “searchresult”: {
    “order”: [
    {
    “shipdocs”: {
    “ship”: {
    “id”: 558743,
    “docid”: “CPR845367829”,
    “date”: “2015-07-16 00:00:00.0”
    }
    },

    “indocs”: {
    “invoice”: {
    “id”: 558217,
    “inno”: 5179747,
    “date”: “2015-07-16 00:00:00.0”
    }
    }

    ,
    “inflag”: 0
    },
    {
    “shipdocs”: {
    “ship”: {
    “id”: 558744,
    “docid”: “CPR845367830”,
    “date”: “2015-07-19 00:00:00.0”
    }
    },

    “indocs”: {
    “invoice”: [
    {
    “id”: 558217,
    “inno”: 5179747,
    “date”: “2015-07-17 00:00:00.0”
    },
    {
    “id”: 558217,
    “inno”: 5179748,
    “date”: “2015-07-17 00:00:00.0”
    }
    ]
    }

    ,
    “inflag”: 0
    }
    }
    }

    JSON Parsing in Grid #74116

    Dimitar
    Participant

    Hello prbvnky,

    Only one data point from the data source can correspond to one grid cell. However, flat arrays can be displayed in cells (example), so if you change your source to:

    {
        "searchresult": {
            "order": [
                {
                    "shipdocs": {
                        "ship": {
                            "id": 558743,
                            "docid": "CPR845367829",
                            "date": "2015-07-16 00:00:00.0"
                        }
                    },
                    "indocs": {
                        "invoice": {
                            "id": 558217,
                            "inno": 5179747,
                            "date": "2015-07-16 00:00:00.0"
                        }
                    },
                    "inflag": 0
                },
                {
                    "shipdocs": {
                        "ship": {
                            "id": 558744,
                            "docid": "CPR845367830",
                            "date": "2015-07-19 00:00:00.0"
                        }
                    },
                    "indocs": {
                        "invoice": [
                            {
                                "id": 558217,
                                "inno": [
                                    5179747,
                                    5179748
                                ],
                                "date": "2015-07-17 00:00:00.0"
                            }
                        ]
                    },
                    "inflag": 0
                }
            ]
        }
    }

    you may be able to bind all invoice inno data to a cell.

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.