aoData[26] is undefined
aoData[26] is undefined
I am using DataTables to get data from an ASP.NET webservice (ASMX). I am trying to pass all the sort information by POST method but keep getting this error. Below is my client-side code:
[code]
$(document).ready(function () {
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"aaSorting": [[ 3, "asc" ]],
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true }
],
"sAjaxSource": "PznDpWs.asmx/Test",
'fnServerData': function (sSource, aoData, fnCallback) {
var Data = { sEcho: aoData[0].value,
iDisplayStart: aoData[3].value,
iDisplayLength: aoData[4].value,
iSortCol_0: aoData[26].value,
sSortDir_0: aoData[27].value,
sSearch: aoData[5].value
};
$.ajax({
"type": "POST",
"data": JSON.stringify(Data),
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"url": sSource,
"success": function (result) {
//alert(result.d);
fnCallback(eval("(" + result.d + ")"));
},
"error": function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest + ": " + textStatus + ": " + errorThrown);
}
});
}
});
});
[/code]
I am very new to all of this and its been years since I ever touched ASP.NET, so please elaborate as much as you can so I can quickly rectify this problem.
Thanks,
[code]
$(document).ready(function () {
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"aaSorting": [[ 3, "asc" ]],
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true }
],
"sAjaxSource": "PznDpWs.asmx/Test",
'fnServerData': function (sSource, aoData, fnCallback) {
var Data = { sEcho: aoData[0].value,
iDisplayStart: aoData[3].value,
iDisplayLength: aoData[4].value,
iSortCol_0: aoData[26].value,
sSortDir_0: aoData[27].value,
sSearch: aoData[5].value
};
$.ajax({
"type": "POST",
"data": JSON.stringify(Data),
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"url": sSource,
"success": function (result) {
//alert(result.d);
fnCallback(eval("(" + result.d + ")"));
},
"error": function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest + ": " + textStatus + ": " + errorThrown);
}
});
}
});
});
[/code]
I am very new to all of this and its been years since I ever touched ASP.NET, so please elaborate as much as you can so I can quickly rectify this problem.
Thanks,
This discussion has been closed.
Replies
Thanks