2

jqueryからJSON使用するために解析されるテキストを取得する Web サービスがあります。$parseJSON

クライアントは、読み込みを行うことで Web サービスからデータを取得できます。http://myserver/myfunction/{pagenumber}/{pagesize}

これはオブジェクトを返します

{
total: <some int> //A number indicating the total number of records
rowsForPage: [......] //An array with just the rows for the requested page
}

このエンドポイントを、選択したページのページ番号とページ サイズを渡す Kendo UI グリッドのデータソースとして使用するにはどうすればよいですか。

私の人生では、これを理解することはできませんが、これは比較的単純なはずだと思います.

4

1 に答える 1

0
$("#grid").kendoGrid({
        dataSource: {
            serverPaging: true,
            schema: {
                data: function(data) {
                    return data.rowsForPage;
                },
                total: function(data) {
                    return data.total;
                }
            },
            transport: {
                read: "http://myserver/myfunction"
            }
    }
);

URLに関する限り、URLパラメータを解析してスキップし、どのレコードを返す必要があるかを特定する必要があります。ページサイズが100で、ページが3の場合、合格するはずです

skip=200&take=100
于 2012-11-17T20:47:35.587 に答える