是否可以将网格数据源复制到新数据源,加载所有数据的新数据源? [英] Is it possible to copy a grid datasource to a new datasource, a new datasource that loads all data?

查看:70
本文介绍了是否可以将网格数据源复制到新数据源,加载所有数据的新数据源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将网格数据源复制到新数据源,加载所有数据的新数据源? 例如,我有一个Kendo网格,其页面大小为10,如何将其复制到新的数据源中,该数据源将加载所有数据并忽略分页.

Is it possible to copy a grid datasource to a new datasource, a new datasource that loads all data? For example I have a kendo grid which has a page size of 10, how would I copy it into a new datasource which will load all the data and ignore the paging.

推荐答案

某些方面可能取决于您如何定义第一个(可分页的)数据源的数据源.但是基本上,您需要复制原始数据源,然后更改pageSizeserverPaging的值,最后使用setDataSource将其分配给第二个网格.

Some aspects might depend on how did you define the DataSource of the first (pageable) datasource. But basically you need to copy the original data source, then change the value for pageSize and serverPaging and finally assign it to the second grid using setDataSource.

示例:

// First DataSource definition
var ds1 = {
    transport: {
        read: ...
    },
    pageSize: 10,
    schema  : {
        model: {
            ...
        }
    }
};

// Copy ds1 definition into ds2
var ds2 = ds1;
// Change values for serverPaging and pageSize
ds2.serverPaging = false;
ds2.pageSize = 0;
// Create new DataSource object and assign it to the second Grid
grid2.setDataSource(new kendo.data.DataSource(ds2));

您可以在以下JSFiddle中看到它的运行情况: http://jsfiddle.net/OnaBai/uj6sr9ez/

You can see this running in the following JSFiddle : http://jsfiddle.net/OnaBai/uj6sr9ez/

这篇关于是否可以将网格数据源复制到新数据源,加载所有数据的新数据源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆