Access custom param using 'download' plugin
Access custom param using 'download' plugin

Hi, I'm using the 'download' plugin for TableTools. It sends the whole set of params that datatable sends to server processing, but I'm having trouble finding the custom params that I push to aoData from the server side. Below is my datatable initialization code.
[code]
var rptTable = $('#tblReport').dataTable({
"bProcessing": true,
"bServerSide": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": 'lfrtip<"clear spacer">T',
"oTableTools": {
"sSwfPath": "../Scripts/copy_cvs_xls_pdf.swf",
"aButtons": [{
"sExtends": "download",
"sButtonText": "CSV",
"sButtonClass": "DTTT_button_csv",
"sButtonClassHover": "DTTT_button_csv_hover",
"sUrl": "Utility/GenerateCSV.aspx"
}]
},
"aaSorting": [[1, "asc"]],
"sAjaxSource": "Services/Data.svc/GetData",
"fnServerData": function (sSource, aoData, fnCallback) {
/* Add some data to send to the source */
aoData.push({ "name": "sSMID", "value": smId });
$.ajax({
dataType: "json",
type: "GET",
contentType: 'application/json',
url: sSource,
data: aoData,
success: function (msg) {
debugger;
$('#pnlView').show();
var json = $.evalJSON(msg.d); //JSON.parse(msg.d);
fnCallback(json);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger;
alert(XMLHttpRequest.statusText);
var errorMessage = JSON.parse(XMLHttpRequest.responseText);
alert(errorMessage.Message);
}
});
}
});
[/code]
In other words, I want to know how I can find the param I added through this line
[code] aoData.push({ "name": "sSMID", "value": smId });[/code]
in Utility/GenerateCSV.aspx, the page that's responsible to generate the csv file.
Thank you so much! Pls let me know if my question is not clear.
--Wenyi
[code]
var rptTable = $('#tblReport').dataTable({
"bProcessing": true,
"bServerSide": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": 'lfrtip<"clear spacer">T',
"oTableTools": {
"sSwfPath": "../Scripts/copy_cvs_xls_pdf.swf",
"aButtons": [{
"sExtends": "download",
"sButtonText": "CSV",
"sButtonClass": "DTTT_button_csv",
"sButtonClassHover": "DTTT_button_csv_hover",
"sUrl": "Utility/GenerateCSV.aspx"
}]
},
"aaSorting": [[1, "asc"]],
"sAjaxSource": "Services/Data.svc/GetData",
"fnServerData": function (sSource, aoData, fnCallback) {
/* Add some data to send to the source */
aoData.push({ "name": "sSMID", "value": smId });
$.ajax({
dataType: "json",
type: "GET",
contentType: 'application/json',
url: sSource,
data: aoData,
success: function (msg) {
debugger;
$('#pnlView').show();
var json = $.evalJSON(msg.d); //JSON.parse(msg.d);
fnCallback(json);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger;
alert(XMLHttpRequest.statusText);
var errorMessage = JSON.parse(XMLHttpRequest.responseText);
alert(errorMessage.Message);
}
});
}
});
[/code]
In other words, I want to know how I can find the param I added through this line
[code] aoData.push({ "name": "sSMID", "value": smId });[/code]
in Utility/GenerateCSV.aspx, the page that's responsible to generate the csv file.
Thank you so much! Pls let me know if my question is not clear.
--Wenyi
This discussion has been closed.
Replies
Allan