Grid-Complicated Json

4 posts, 1 answers
  1. Vikas
    Vikas avatar
    6 posts
    Member since:
    Sep 2020

    Posted 12 Oct Link to this post

    Hi ,

     

    I need help building kendo grid with angular 10.

    I am having difficulty accessing data of nested json.

    have attached  pic as reference and sharing json as well.

    Having issue accessing resource record for objects in array.

    Please look in the pic attached for reference as i want the same.

     

    {
        "fieldTestPlanId": 509,
        "Operation1": [
            {
                "id": 2381,
                "manageOperationId": 341,
                "title1": "data1",
                "title2": "1",
                "operationId": 55948,
                "subOperationId": 56968,
                "operationGoal": 1,
                "instructions": " ",
                "frCount": null,
                "resources": [
                    {
                        "id": 38275,
                        "filedTestOperationId": 2381,
                        "resourceId": 1123,
                        "resourceIdWithPreFix": "1123",
                        "c1": null,
                        "c2": 2
                    },
                    {
                        "id": 38276,
                        "filedTestOperationId": 2381,
                        "resourceId": 2421,
                        "resourceIdWithPreFix": "2421",
                        "c1": 2.0,
                        "c2": null
                    }
                ]
            },
            {
                "id": 2379,
                "manageOperationId": 11,
                "title1": "Unassigned",
                "title2": "Unassigned",
                "operationId": 2057,
                "subOperationId": 2058,
                "operationGoal": 3,
                "instructions": null,
                "frCount": null,
                "resources": [
                    {
                        "id": 38273,
                        "filedTestOperationId": 2379,
                        "resourceId": 1123,
                        "resourceIdWithPreFix": "1123",
                        "c1": null,
                        "c2": 4
                    },
                    {
                        "id": 38274,
                        "filedTestOperationId": 2379,
                        "resourceId": 2421,
                        "resourceIdWithPreFix": "2421",
                        "c1": null,
                        "c2": null
                    }
                ]
            }
        ],
        "fieldTestPlanUUTGroupResourceList": [
            {
                "resorceId": 1123,
                "resourceIdWithPrefix": "1123",
                "resourceName": "data",
                "resourceTotalActual": null,
                "resourceTotalPlan": null
            },
            {
                "resorceId": 2421,
                "resourceIdWithPrefix": "2421",
                "resourceName": "test",
                "resourceTotalActual": null,
                "resourceTotalPlan": null
            }
        ]
    }

  2. Answer
    Svetlin
    Admin
    Svetlin avatar
    448 posts

    Posted 14 Oct Link to this post

    Hi Vikas,

    Thank you for the provided screenshot and json object.

    It seem that you are unable to get the desired Grid behavior due to the used json object structure. In general the [data] input property of the Grid supports only one level arrays or objects of type GridDataResult, where the data property is supposed to be a one level array. If there are more levels of arrays then the Grid won't be able to represent the data as desired. Thus, I would suggest to reconstruct the data so that it consists of a single array level and then define the desired Grid columns.

    Regards,
    Svetlin
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  3. Vikas
    Vikas avatar
    6 posts
    Member since:
    Sep 2020

    Posted 14 Oct in reply to Svetlin Link to this post

    Thanks for your reply .
    Correct me if i am wrong, so you are suggesting  to create a simple array or 1d array. 
    But my array consist of another array, i.e, of resources, and its rendering data row wise for particular operation.

    How can this be achieved.

    Please help.

  4. Vikas
    Vikas avatar
    6 posts
    Member since:
    Sep 2020

    Posted 14 Oct in reply to Svetlin Link to this post

    Thank for you valuable help Svetlin.

     

    I was able to get desired result.

     

Back to Top