【问题标题】:Is it possible to use the virtual load on demand (scrollbar paging) in jqGrid with a JSON file loaded locally?是否可以在 jqGrid 中使用虚拟负载按需加载(滚动条分页)和本地加载的 JSON 文件?
【发布时间】:2019-10-04 08:09:04
【问题描述】:

我需要使用虚拟按需加载模式 - 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
});

任何帮助将不胜感激:)

【问题讨论】:

    标签: jquery jqgrid autoscroll


    【解决方案1】:

    所以我的问题是,是否可以使用我的本地 JSON 来实现这一点?

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

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

    【讨论】:

      猜你喜欢
      • 2012-03-29
      • 2012-10-05
      • 1970-01-01
      • 2016-08-05
      • 2011-11-12
      • 1970-01-01
      • 2021-11-24
      • 1970-01-01
      相关资源
      最近更新 更多