将jQgrid中的数据从jquery代码导出为pdf

将jQgrid中的数据从jquery代码导出为pdf,jquery,jqgrid,export-to-pdf,Jquery,Jqgrid,Export To Pdf,我在我的页面中使用jQgrid。我需要将网格中显示的数据导出为pdf和excel。我创建了一个按钮,并添加了如下代码 jQuery("#btnExportPdf").on("click", function(){ jQuery("#jqGrid").jqGrid("exportToPdf",{ title: 'Export to PDF', orientation: 'portrai

我在我的页面中使用jQgrid。我需要将网格中显示的数据导出为pdf和excel。我创建了一个按钮,并添加了如下代码

 jQuery("#btnExportPdf").on("click", function(){
                jQuery("#jqGrid").jqGrid("exportToPdf",{
                    title: 'Export to PDF',
                    orientation: 'portrait',
                    pageSize: 'A4',
                    description: 'Meeting Details',
                    customSettings: null,
                    download: 'download',
                    includeLabels : true,
                    includeGroupHeader : true,
                    includeFooter: true,
                    fileName : "Meetings.pdf"
                })
            }) 

我还需要做什么

尝试使用此功能

    function exportGrid() {
        mya = $("#" + table).getDataIDs(); // Get All IDs
        var data = $("#" + table).getRowData(mya[0]); // Get First row to get the
        // labels
        var colNames = new Array();
        var ii = 0;
        for (var i in data) {
            colNames[ii++] = i;
        } // capture col names

        var html = "<html><head>"
        + "<style script=&quot;css/text&quot;>"
        + "table.tableList_1 th {border:1px solid black; text-align:center; "
        + "vertical-align: middle; padding:5px;}"
        + "table.tableList_1 td {border:1px solid black; text-align: left; vertical-align: top; padding:5px;}"
        + "</style>"
        + "</head>"
        + "<body style=&quot;page:land;&quot;>";


        for (var k = 0; k < colNames.length; k++) {
            html = html + "<th>" + colNames[k] + "</th>";
        }
        html = html + "</tr>"; // Output header with end of line
        for (i = 0; i < mya.length; i++) {
            html = html + "<tr>";
            data = $("#" + table).getRowData(mya[i]); // get each row
            for (var j = 0; j < colNames.length; j++) {
                html = html + "<td>" + data[colNames[j]] + "</td>"; // output each Row as
                // tab delimited
            }
            html = html + "</tr>"; // output each row with end of line
        }
        html = html + "</table></body></html>"; // end of line at the end
        alert(html);
        html = html.replace(/'/g, '&apos;');
    }
函数exportGrid(){
mya=$(“#”+表).getDataIDs();//获取所有ID
var data=$(“#”+table).getRowData(mya[0]);//获取第一行以获取
//标签
var colNames=新数组();
var ii=0;
用于(数据中的var i){
colNames[ii++]=i;
}//捕获列名称
var html=“”
+ ""
+“table.tableList_第1个{边框:1px纯黑色;文本对齐:居中;”
+“垂直对齐:中间;填充:5px;}”
+“table.tableList_1 td{边框:1px纯黑色;文本对齐:左侧;垂直对齐:顶部;填充:5px;}”
+ ""
+ ""
+ "";
for(var k=0;k

从何处调用exportGrid()函数?在单击事件@aa中,没有显示任何用于在我的末尾标记为重复的链接,这就是为什么我要这样做@DipenShah