是否可以在 jqGrid 中使用按需虚拟加载(滚动条分页)和本地加载的 JSON 文件?

Is it possible to use the virtual load on demand (scrollbar paging) in jqGrid with a JSON file loaded locally?

我需要使用虚拟按需加载模式 - 在 jqGrid 上使用 JSON 本地文件进行滚动条分页,因为该文件包含 12.800 行(3.3Mb)并且立即加载时几乎冻结了我的 Chrome(并且绝对杀死了我的 IE11)。所以我的问题是,是否可以用我的本地 JSON 实现 this

这是我的代码(现在我只请求 'data3.json' 文件(包含 12.800 行)的前 100 行:

$('#table').jqGrid({
    datatype: 'json',
    url: "data3.json",
    colNames: ['', 'TUBE ID'],
    colModel: [
        { name: 'selector',     index: 'selector'},
        { name: 'tube_id',      index: 'tube_id'}
    ],
    viewrecords: true,
    scroll: 1, // set the scroll property to 1 to enable paging with scrollbar - virtual loading of records
    emptyrecords: 'Scroll to bottom to retrieve new page', // the message will be displayed at the bottom 
    pager: "#jqGridPager",   
    rowNum: 100
});

任何帮助将不胜感激:)

So my question is, is it possible to achieve this with my local JSON?

不,这不可能。这是因为使用当前方法,您必须在请求中加载 entire 文件。您不能部分加载文件。

要执行您的要求,您需要一些服务器端逻辑来一次检索一个页面,最好是从比文件系统更具可扩展性的数据源(例如数据库)中检索。