This is a migrated thread and some comments may be shown as answers.

Grid-Complicated Json

3 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Veteran
Vikas asked on 12 Oct 2020, 01:43 PM

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
        }
    ]
}

3 Answers, 1 is accepted

Sort by
0
Accepted
Svet
Telerik team
answered on 14 Oct 2020, 09:13 AM

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/.

0
Vikas
Top achievements
Rank 1
Veteran
answered on 14 Oct 2020, 10:46 AM

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.

0
Vikas
Top achievements
Rank 1
Veteran
answered on 14 Oct 2020, 03:12 PM

Thank for you valuable help Svetlin.

 

I was able to get desired result.

 

Tags
Grid
Asked by
Vikas
Top achievements
Rank 1
Veteran
Answers by
Svet
Telerik team
Vikas
Top achievements
Rank 1
Veteran
Share this question
or