2014-09-12 151 views
0

我想了解Kendo UI網格是如何工作的。這the example for the Kendo website分頁不能在Kendo Grid上工作

某處一個可以找到這個配置行:

pageSize: 20, 
serverPaging: true, 
serverFiltering: true, 
serverSorting: true 

這是取數據線

transport: { 
      read: "http://demos.telerik.com/kendo- ui/service/Northwind.svc/Orders" 
     }, 

不知是否上述參數被髮送到服務器,即服務器端的方法應該這樣?

public list<type> MyServerSideMethod(inr pageSize, bool serverPaging, 
        bool serverFiltering, boll serverSorting) 
{ 

} 

實際上,我已經應用了配置,但我的網格上的傳呼機仍然無法工作。這就是爲什麼我想知道服務器中的方法是否期待這些值。

感謝幫助

回答

0

定義你讀的功能和操作參數發送到服務器

transport: { 
      read: function (options) { 
       console.log(JSON.stringify(options)); // You can see what parameters send : check your console on paging 

       var commandOBJ=[{ 
        Page: 1, // Once the first 20 item is loaded and you click for the next page you will have the page in "options" (should be like options.page) 
        PageSize:20 
       }]; 

       $.ajax({ 
        url:"http://demos.telerik.com/kendo- ui/service/Northwind.svc/Orders", 
        data: { }, // send your page info here 
        dataType: "json", // your data return type 
        cache: false, 
        success: function (result) { 
         options.success(result); 
        }, 
        error: function (result) { 
         options.error(result); 
        } 
       }); 
      } 
     }