jqGrid getData仅返回当前页面的数据 [英] jqGrid getData only returns data for current page

查看:212
本文介绍了jqGrid getData仅返回当前页面的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望这是一个快速的方法!

Hopefully this is a quick one!

我有一个使用"clientSide"(本地)数据的可编辑网格,现在我希望对javascript中的所有行进行迭代,并自己处理/打包数据,然后再通过jQuery.ajax调用将其发送到服务器.

I have an editable grid using 'clientSide' (local) data and I now wish to iterate all the rows in javascript and process/package the data myself before sending it to the server via a jQuery.ajax call.

问题是,出乎意料的(至少对我来说),使用以下代码仅检索当前可见的网格页面的行!如何获取网格中的所有行(即,我有4页,每页10条记录,而当我在第1页上时,此代码仅返回前10条)?它们必须出现在客户端的某个地方,因为我可以在页面中四处浏览和编辑行,并且数据可以持久保存而无需调用服务器! :)

The problem is that, unexpectedly (for me at least), using the following code only retrieves the rows for the currently visible grid page! How can I get ALL the rows in the grid (i.e. I have four pages of 10 records each and this code only returns the first 10 when I'm on page 1)? They must be present in the client somewhere because I can page around and edit the rows and the data is persisted without calling the server! :)

    cacheCONF = [];
    var rows= $('#myGrid').getRowData();  //<--Need to get ALL rows here!!!
    var cacheRowID = 0;
    for (var row in rows) {
        if (rows[row].Action == 'Yes') {
            cacheCONF.push({ RowID: rowID, System: rows[row].System, Action: rows[row].Action, Account: '-', Required: '-'  });
            rowID++;
        }
    }

推荐答案

托尼的解决方案:

var mydata = $("#grid").jqGrid('getGridParam','data');

这篇关于jqGrid getData仅返回当前页面的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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