Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带摘要导出的分组JqGrid_Javascript_Jquery_Jqgrid - Fatal编程技术网

Javascript 带摘要导出的分组JqGrid

Javascript 带摘要导出的分组JqGrid,javascript,jquery,jqgrid,Javascript,Jquery,Jqgrid,我想将jqgrid导出到excel。这段代码对于基本jqgrid来说运行良好,但我想导出分组jqgrid,其中包含每个组的摘要。我无法导出所有数据。未导出的每个组的摘要。我无法用javascript获取每个组的摘要,以便手动发送到服务器 我只在服务器端使用Jqgrid客户端,我只是在生成excel所有数据,然后使用表单提交返回到服务器以生成excel 这是我的网格: 读取未在excel中导出的边框数据 这是我的Excel文件 我在javascript中的导出功能是: function fun

我想将jqgrid导出到excel。这段代码对于基本jqgrid来说运行良好,但我想导出分组jqgrid,其中包含每个组的摘要。我无法导出所有数据。未导出的每个组的摘要。我无法用javascript获取每个组的摘要,以便手动发送到服务器

我只在服务器端使用Jqgrid客户端,我只是在生成excel所有数据,然后使用表单提交返回到服务器以生成excel

这是我的网格: 读取未在excel中导出的边框数据

这是我的Excel文件

我在javascript中的导出功能是:

function fun(){alert("call"); 

//options = ['xmlstring','grid'];
//jQuery("#list2").jqGrid('jqGridExport',options);
//userdata = jQuery("#list2").getUserData;

 numberOfRecords = $("#list2").getGridParam("records");

var mya=new Array();
    total = jQuery("#list2").jqGrid('footerData','get'); // to get the last footer data
    obj2 = jQuery("#list2").jqGrid('getCol','amount','array','sum');
    group = jqobj.groupField;

mya=jQuery("#list2").getDataIDs();  // Get All IDs
var data=jQuery("#list2").getRowData(mya[0]);     // Get First row to get the labels
var colNames=new Array();  
var ii=0;
var html="";
for (var i in data){colNames[ii++]=i;
html = html +i+"\t";}    // capture col names
html = html + "\n";
for(i=0;i<mya.length;i++)
    {
        data=jQuery("#list2").getRowData(mya[i]); // get each row
        for(j=0;j<colNames.length;j++)
            {
                html=html+data[colNames[j]]+"\t"; // output each column as tab delimited
            }
        html=html+"\n";  // output each row with end of line

    }

for(j=0;j<colNames.length;j++)
{
    html=html+total[colNames[j]]+"\t"; // output each column as tab delimited
}   

html=html+"\n";  // end of line at the end
//document.forms[0].csvBuffer.value = csv
alert(html);
document.forms[0].csvBuffer.value=html;
document.forms[0].method='POST';
document.forms[0].action='csvExport.jsp';  // send it to server which will open this contents in excel file
document.forms[0].target='_blank';
document.forms[0].submit();

}
函数fun(){alert(“call”);
//选项=['xmlstring','grid'];
//jQuery(“#list2”).jqGrid('jqGridExport',options);
//userdata=jQuery(“#list2”).getUserData;
numberOfRecords=$(“#列表2”).getGridParam(“记录”);
var mya=新数组();
total=jQuery(“#list2”).jqGrid('footerData','get');//获取最后一个页脚数据
obj2=jQuery(“#list2”).jqGrid('getCol','amount','array','sum');
group=jqobj.groupField;
mya=jQuery(“#list2”).getDataIDs();//获取所有ID
var data=jQuery(“#list2”).getRowData(mya[0]);//获取第一行以获取标签
var colNames=新数组();
var ii=0;
var html=“”;
对于(数据中的var i){colNames[ii++]=i;
html=html+i+“\t”}//捕获列名称
html=html+“\n”;
对于(i=0;i