I am new in jQuery/jQgrid coding. I am using jQgrid version is 4.4.4 & jQuery 1.8.3. I want to enable export to PDF/EXCEL functionality in my jQgrid. For that I referred
function to be called inside of your onclick event.
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 = ""
+ ""
+ ""
+ "";
for ( var k = 0; k < colNames.length; k++) {
html = html + "" + colNames[k] + " ";
}
html = html + ""; // Output header with end of line
for (i = 0; i < mya.length; i++) {
html = html + "";
data = $("#" + table).getRowData(mya[i]); // get each row
for ( var j = 0; j < colNames.length; j++) {
html = html + "" + data[colNames[j]] + " "; // output each Row as
// tab delimited
}
html = html + " "; // output each row with end of line
}
html = html + ""; // end of line at the end
alert(html);
html = html.replace(/'/g, ''');
// var form = "