1.结论:按正常jqGid获取,在中间加入以下代码,即将小计行当成改变为普能行,以便能让'getRowData'方法获取到,第三点会进行原码分析

 //get all page grid data,including group count row
getJQAllData:function (jqGridId) {
var o = $("#"+jqGridId);
//get current page data $("#jqGridList").jqGrid('getRowData');
var rows=[];
rows= o.jqGrid('getRowData');
var rowNum = o.jqGrid('getGridParam', 'rowNum'); //get the record amount of current page data
var total = o.jqGrid('getGridParam', 'records'); //get the total records of all page
//reload the all data with no spliting of page,then can get all real data by invoking the function getRowData
o.jqGrid('setGridParam', { rowNum: total }).trigger('reloadGrid'); //here modify temporaily the attributes of "the group count row" ,so that can get the rows by invoking the function getRowData
//will restore after below reloadGrid is invoked
//below three row codes can be executed lonely in IE console
//if want to understand more please refer to the definition of function getRowData in js/jgGrid/jquery.jqGrid.src.js
$('tr[id^="jqGridListghead"]').addClass("jqgrow");//add the class to set it as normal row
$('tr[id^="jqGridListghead"] td').attr("role","gridcell");//add the attributes to set it as normal row
$('tr[id^="jqGridListghead"] td span').remove();//remove unnecessary <span> in the first <td> of the "the group count row",otherwise the got value from <td> will include excessive "<span....>"
rows = o.jqGrid('getRowData'); //get all grid data,and return {} if emtpy
o.jqGrid('setGridParam', { rowNum: rowNum }).trigger('reloadGrid'); //reset the original show
console.log("getJQAllData==>");
console.log(rows);
return (rows instanceof Array)?rows:[];
}

2.获取小计行

3.原码分析:在jquery.jqGrid.src.js第3103行找到方法定义,发现对标题进行了过滤,只需要对相应元素增加属性即可。

getRowData : function( rowid ) {
var res = {}, resall, getall=false, len, j=0;
this.each(function(){
var $t = this,nm,ind;
if(rowid === undefined) {
getall = true;
resall = [];
len = $t.rows.length;
} else {
ind = $($t).jqGrid('getGridRowById', rowid);
if(!ind) { return res; }
len = 2;
}
while(j<len){
if(getall) { ind = $t.rows[j]; }
if( $(ind).hasClass('jqgrow') ) {
$('td[role="gridcell"]',ind).each( function(i) {
nm = $t.p.colModel[i].name;
if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
if($t.p.treeGrid===true && nm === $t.p.ExpandColumn) {
res[nm] = $.jgrid.htmlDecode($("span:first",this).html());
} else {
try {
res[nm] = $.unformat.call($t,this,{rowId:ind.id, colModel:$t.p.colModel[i]},i);
} catch (e){
res[nm] = $.jgrid.htmlDecode($(this).html());
}
}
}
});
if(getall) { resall.push(res); res={}; }
}
j++;
}
});
return resall || res;
}

jqGrid pivot获取所有行包括小计数据及原码分析的更多相关文章

  1. Spring IOC 容器源码分析 - 获取单例 bean

    1. 简介 为了写 Spring IOC 容器源码分析系列的文章,我特地写了一篇 Spring IOC 容器的导读文章.在导读一文中,我介绍了 Spring 的一些特性以及阅读 Spring 源码的一 ...

  2. java使用websocket,并且获取HttpSession,源码分析

    转载请在页首注明作者与出处 http://www.cnblogs.com/zhuxiaojie/p/6238826.html 一:本文使用范围 此文不仅仅局限于spring boot,普通的sprin ...

  3. jqgrid 获取所有行数据

    如何获取jqgrid所有数据? 通过 getRowData() 方法获得当前行数据 //获取所有行数据,是一个json对象集合 var rowArr= $("#jqGrid").g ...

  4. JS获取网页属性包括宽、高等

    JS获取网页属性包括宽.高等. function getInfo()  { // www.jbxue.com var s = "";  s += " 网页可见区域宽:&q ...

  5. inux关于readlink函数获取运行路径的小程序

    inux关于readlink函数获取运行路径的小程序   相关函数: stat, lstat, symlink 表头文件: #include <unistd.h> 定义函数:int  re ...

  6. 微信小程序开发——获取小程序带参二维码全流程

    前言: 想要获取微信小程序带参数二维码,如这种: 官方文档只说了获取小程序码和二维码的三种接口及调用(参考链接:https://developers.weixin.qq.com/miniprogram ...

  7. python excel操作 练习-#操作单列 #操作A到C列 #操作1到3行 #指定一个范围遍历所有行和列 #获取所有行 #获取所有列

    ##操作单列#操作A到C列#操作1到3行#指定一个范围遍历所有行和列#获取所有行#获取所有列 #coding=utf-8 from openpyxl import Workbook wb=Workbo ...

  8. 通过kfed自动获取磁盘信息的小脚本

    通过kfed自动获取磁盘信息的小脚本 编译KFED [oracle@rac lib]$cd $ORACLE_HOME/rdbms/lib [oracle@rac lib]$ pwd /u01/app/ ...

  9. 获取不同机型微信小程序状态栏+导航栏高度

    获取不同机型微信小程序状态栏+导航栏高度 一. 前言 很多时候我们开发微信小程序,都需要先知道状态栏和导航栏的高度,才能去做其他功能 二. 获取微信小程序状态栏高度 用wx.getSystemInfo ...

随机推荐

  1. github简单命令

    1.安装yum install -y git 2.配置帐户(github.com注册)git config --global user.name goozgkgit config --global u ...

  2. 峰Redis学习(9)Redis 集群(概述)

    第一节:Redis 集群概述 redis cluster是去中心化,去中间件的,也就是说,集群中的每个节点都是平等的关系,都是对等的,每个节点都保存各自的数据和整个集群的状态.每个节点都和其他所有节点 ...

  3. JavaScript之图片操作6

    上一篇写的关于放大镜的,可能在实际开发中用的不是很多,接下来将的图片无缝滚动在实际工作中就是用的比较多的了. 如上图,通过定时器控制图片无缝滚动,当鼠标悬浮时停止滚动,鼠标离开,滚动继续. 主要原理是 ...

  4. Web jsp开发学习——点击菜单页面切换

      两个网页使用同一个head,在点击“首页”后,head的“首页”变成绿色,点击“新闻”后,head的“新闻”变成绿色,head的“首页”恢复原来的颜色   head.jsp <%@ page ...

  5. jquery add() 和js add()

    HTML DOM add() 方法 HTML DOM Select 对象 定义和用法 add() 方法用于向 <select> 添加一个 <option> 元素. 语法 sel ...

  6. 廖雪峰Java5集合-4Set-1使用Set

    集合 Set用于存储不重复的元素集合: boolean add(E e) boolean remove(Object o) boolean contains(Object o) int size() ...

  7. 廖雪峰Java1-3流程控制-4switch多重选择

    switch语句 根据switch(表达式)跳转到匹配的case结果,继续执行case结果: 的后续语句,遇到break结束执行,没有匹配条件,执行default语句. int i = 3 switc ...

  8. datetime模块常用功能小结

  9. 云计算的三种服务模式:IaaS,PaaS和SaaS

    云服务”现在已经快成了一个家喻户晓的词了.如果你不知道PaaS, IaaS 和SaaS的区别,那么也没啥,因为很多人确实不知道. “云”其实是互联网的一个隐喻,“云计算”其实就是使用互联网来接入存储或 ...

  10. 如何查看yum 安装的软件路径

    1.首先安装一个redis [root@iZbp1eem925ojwyx17ao9kZ ~]# yum install redis 2.查找redis的安装包 [root@iZbp1eem925ojw ...