2014-09-12 75 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); 
        } 
       }); 
      } 
     }