JSON data bind with Kendo Grid can't display

3 posts, 0 answers
  1. ZHILONG
    ZHILONG  avatar
    2 posts
    Member since:
    Sep 2016

    Posted 21 Sep Link to this post

    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. ZHILONG
    ZHILONG  avatar
    2 posts
    Member since:
    Sep 2016

    Posted 22 Sep in reply to ZHILONG Link to this post

    figure out, set data: "";
  3. Kendo UI is VS 2017 Ready
  4. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    119 posts

    Posted 22 Sep Link to this post

    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.
Back to Top