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

Grid with Json Variable and Schema

3 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 11 Jun 2020, 12:38 PM

Hi All, 

   I have a js variable JSON_DATA that contains the return result from a .py api.  It has a schema 'xyz' and 5 columns (a,b,c,d,e).  I've tried to setup the the schema and datasource several different ways and I can't seem to get it to bind the data.  Can someone shed some light on this for me?  See below:

This is where I'm at now, I removed schema to see if I could get something back but I'm stuck: 

 

 \$(document).ready(function() {
                     \$("#grid").kendoGrid({
                        dataSource: {
                            data: $JSON_DATA },
                        height: 550,
                        scrollable: true,
                        sortable: true,
                        filterable: true,
                        pageable: {
                            input: true,
                            numeric: false
                        },
                        columns: [
                          { field: 'productType', title: 'CSS-WX Product Type', width: '230px'}, 
                            { field: 'serviceType', title: 'Web Service Type', width: '100px'},
                            { field: 'average', title: 'Average', width: '130px' },
                            { field: 'target', title: 'Target', width: '130px' },
                            { field: 'iterations', title: 'Iterations', width: '130px' }
                        ]
                    });
                });

3 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 15 Jun 2020, 10:58 AM

Hello Richard,

Thank you for the provided code snippet. I tested it in this Dojo example with some dummy data, and it seems to be working as expected. Could you please review the example and if it does not completely replicate your scenario, modify it to do so? I will then be able to test it and discover what is causing the issue.

Looking forward to your reply.

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Richard
Top achievements
Rank 1
answered on 15 Jun 2020, 11:26 AM

Hi Martin, 

  Thank you for the reply, the problem is I need to incorporate the schema.  It doesn't work correctly when I do so.  That's where I'm stuck.  ex data: 

 

{ "mySchemaXYZ": [ {  productType: "Product 1", serviceType:"Service 1", average: "Average 1", target: "Target 1", iterations: "Interation 1" }, { productType: "Product 2", serviceType:"Service 2", average: "Average 2", target: "Target 2", iterations: "Interation 2" } ]}

 

0
Martin
Telerik team
answered on 17 Jun 2020, 09:31 AM

Hello Richard,

On my side the provided example is working as expected without a schema. Still, if you need to add one, you need to do that in the DataSource definition and not in the variable containing the data. Here is a small example for reference.

Let me know if that works for you.

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Martin
Telerik team
Richard
Top achievements
Rank 1
Share this question
or