2017-04-20 2 views
0

몇 가지 KendoUI Grid를 성공적으로 설정했지만 서버 쪽 페이징을 사용하여 작업 할 수 없습니다.KendoUI Grid Server 바인딩 예

전체 값 (현재 하드 코딩 됨)을 반환하도록 내 휴식 서비스를 수정했습니다.

또한 자바 스크립트 소스를 수정했습니다. [아래 참조].

일반적으로 빈 화면이 나타납니다.

도움이 필요하시면 매우 감사드립니다.

스크립트 :

$(document).ready(function(){ 

     // Setup Rest Service 
     var loc = (location.href); 
     var url = loc.substring(0, loc.lastIndexOf("/")) + "/xpRest.xsp/test/"; 


     dataSource = new kendo.data.DataSource({ 
      pageSize: 20, 
      serverPaging: true, 
      serverFiltering: true, 
      serverSorting: true,   transport : { 
       read : { 
        url : url + "READ", 
        dataType : "json" 
       }, 
       type : "READ" 
      }, 
      schema : { 
        total: "total", 
        model : { 
        id : "unid", 
        fields : { 
         unid : { 
          type : "string",  
          nullable : false 
         }, 
          tckNbr : { 
          type : "string", 
          editable : false 
         }, 
          tckSts : { 
          type : "string", 
          editable : false 
         } 
       } 
      } 
     } 
     }); 

      grid = $("#grid-databound-dataItem").kendoGrid({  
      dataSource : dataSource, 
      height: 550, 
      filterable: true, 
      sortable: true, 
      pageable: true,   
      columns : [   
         {field : "tckNbr", title : "Number", type: "string"}, 
         {field : "tckSts", title : "Status", type: "string"} 
         ] 
      }).data("kendoGrid"); 
     }); 

JSON 피드 :

[ 
    { 
     "total":100, 
     "data": 
     [   
      { 
       "tckNbr":"3031", 
       "tckSts":"1 Not Assigned", 
       "unid":"0014DA9095BF6D638625810700597A36", 
       "tckReqs":"Bryan S Schmiedeler", 
       "tckNts": 
       [ 
       "Bryan DeBaun" 
       ], 
       "tckBUs": 
       [ 
       "NAP\/IFI" 
       ], 
       "tckApps":"GTM", 
       "tckType":"Issue", 
       "tckPriority":"Medium" 
      },   
      { 
       "tckNbr":"3031", 
       "tckSts":"1 Not Assigned", 
       "unid":"00598976D88226D2862581070059AD25", 
       "tckReqs":"Bryan S Schmiedeler", 
       "tckNts": 
       [ 
       "Bryan DeBaun" 
       ], 
       "tckBUs": 
       [ 
       "NAP\/IFI" 
       ], 
       "tckApps":"GTM", 
       "tckType":"Issue", 
       "tckPriority":"Medium" 
      }   
     ] 
    } 
] 

답변

1

수정하여 JSON 피드, 그렇지 배열 개체를 반환해야하는 데이터가 무엇을 말 한

{ 
    "total": 10, 
    "data": [] 
} 

및 스키마의 총계는 무엇입니까?

참고 : 귀하의 경우와 같이 데이터를 모의하면 (총 : 100, 데이터 - 크기 : 2) 귀하는 귀하의 페이지가 데이터 자체가 아닌 총 매개 변수에 의해 생성됩니다. 동일한 데이터 (확인)로 5 페이지를 볼 수 있습니다.