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

JSON data bind with Kendo Grid can't display

2 Answers 1195 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
ZHILONG
Top achievements
Rank 1
ZHILONG asked on 21 Sep 2016, 07:31 AM

Hello Everyone,

I am developing a ASP.NET MVC program with angular kendoUI, my program gets JSON data successfully, but the data can not display in kendo GRID normally. Could anyone provide some advice, thank you.

Image:

 

Javascript:

function getDetailRouting(dataItem) {
 
 
           return {
               dataSource: {
                   //data: $scope.Structure
                   //type: "Json",
                   transport: {
                       read: "/api/routings/details/" + dataItem.Model + "/" + dataItem.PCBA
                   }
                   ,
                   schema: {
                       data: "data",
                       model: {
                           fields: {
                               Model: { type: "string" },
                               PCBA: { type: "string" },
                               SeqNo: { type: "int" },
                               Process: { type: "string" },
                               FailedUnitReturnTo: { type: "string" },
                               MaxTestRound: { type: "int" },
                               MaxFailure: { type: "int" },
                               StandardTime: { type: "date" },
                               SamplingTest: { type: "boolean" },
                               SamplingLogic: { type: "string" },
                               PanelMatching: { type: "boolean" },
                               PanelSize: { type: "int" },
                               RetestFlag: { type: "string" },
                               MatchingbyExtSN: { type: "boolean" },
                               Label1: { type: "string" },
                               Label2: { type: "string" },
                               Label3: { type: "string" },
                           }
                       }
                   },
                   serverPaging: true,
                   serverSorting: true,
                   serverFiltering: true,
                   pageSize: 5,
                   ////filter: { field: "EmployeeID", operator: "eq", value: dataItem.EmployeeID }
               },
               height: 150,
               scrollable: true,
               sortable: true,
               pageable: true,
               filterable: true,
               columns: [
               { field: "Model", title: "Model", width: "56px" },
               { field: "PCBA", title: "PCBA", width: "110px" }
               ]
           };
 
       }

Html:

<div kendo-grid id="grid" k-options="StructureGrid"  k-data-source="StructureGrid.dataSource">
    <div k-detail-template>
        <kendo-tabstrip>
            <ul>
                <li class="k-state-active">Routing</li>
                <li>Contact information</li>
            </ul>
            <div>
                <div kendo-grid k-options="getDetailRouting(dataItem)"></div>
            </div>
            <div>
                <ul class="contact-info-form">
                    <li><label>SeqNo:</label> <input class="k-textbox" ng-model="dataItem.Country" /></li>
                    <li><label>Process:</label> <input class="k-textbox" ng-model="dataItem.City" /></li>
                    <li><label>Failed Unit Return TO:</label> {{dataItem.Address}}</li>
 
                </ul>
            </div>
        </kendo-tabstrip>
    </div>
</div>

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
ZHILONG
Top achievements
Rank 1
answered on 22 Sep 2016, 09:11 AM
figure out, set data: "";
0
Alex Hajigeorgieva
Telerik team
answered on 22 Sep 2016, 03:18 PM
Hi Zhilong,

The Kendo UI Data Source schema data configuration property is not always necessary. It depends on the server response:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data 

It seems that you may remove the schema data configuration because the response contains only the dataItems.

Regards,
Alex
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Tags
Data Source
Asked by
ZHILONG
Top achievements
Rank 1
Answers by
ZHILONG
Top achievements
Rank 1
Alex Hajigeorgieva
Telerik team
Share this question
or