aoData[26] is undefined

aoData[26] is undefined

dotmundodotmundo Posts: 13Questions: 0Answers: 0
edited February 2011 in General
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,

Replies

  • dotmundodotmundo Posts: 13Questions: 0Answers: 0
    I forgot to mention that the portion that starts on line 15 where I create the Data variable was copied from an example on this website. The reality is that I cannot find any info on this site what the index values of aoData are. Can someone please point me to right direction?

    Thanks
  • dotmundodotmundo Posts: 13Questions: 0Answers: 0
    Ok I figured this out on my own and as for the 2nd question, I used Firebug to show me the order of what was being POSTed and corrected the index.
  • tohidazizitohidazizi Posts: 3Questions: 0Answers: 0
    edited March 2011
    Assume that I just want to replace the value of iDisplayStart with my own value. Is there anyway to do that?
This discussion has been closed.