Request Parameter '0' from the data source for row 0
Request Parameter '0' from the data source for row 0
i'm getting the Request Parameter '0' from the data source for row 0 error when trying to use server side processing. I'm thinking it's trying to my JSON as an array or arrays rather than an array of objects but I can't quite figure it out...please help!!
Here's my JSON
[code]
{"sEcho":1,"iTotalRecords":1,"iTotalDisplayRecords":1,"aaData":[{"DateListProduced":"Sep 27 2013","RecordObsolescenceDate":"Mar 27 2014","Source":"Infogroup","COMPANYNAME":"1 800 Asphalt","ADDRESS":"15041 Old Seward Hwy","CITY":"Anchorage","STATE":"AK","ZIPCODE":"99516-3978","MAILINGCARRIERROUTE":"C018","MAILINGDELIVERYPOINTBARCODE":"418","LOCATIONADDRESS":"15041 Old Seward Hwy","LOCATIONADDRESSCITY":"Anchorage","LOCATIONADDRESSSTATE":"AK","LOCATIONADDRESSZIP":"99516-3978","LOCATIONADDRESSDELIVERYPOINTBARCODE":"418","LOCATIONADDRESSCARRIERROUTE":"C018","COUNTY":"Anchorage","PHONENUMBER":"9072774258","WEBADDRESS":"www.topasphaltcompany.com","LASTNAME":"James","FIRSTNAME":"Dena","CONTACTTITLE":"OWNER","CONTACTPROFTITLE":"","CONTACTGENDER":"Female","ACTUALEMPLOYEESIZE":"000000000016","EMPLOYEESIZERANGE":"10 to 19","ACTUALSALESVOLUME":"000006498000","SALESVOLUMERANGE":"$5 - 10 Million","PRIMARYSIC":"161101","PRIMARYSICDESCRIPTION":"Paving Contractors","SECONDARYSIC#1":"161101","SECONDARYSICDESCRIPTION#1":"Paving Contractors","SECONDARYSIC#2":"","SECONDARYSICDESCRIPTION#2":"","CREDITALPHASCORE":"B+","CREDITNUMERICSCORE":"086","HEADQUARTERS/BRANCH":"Single Loc","YEAR1STAPPEARED":"2010","OFFICESIZE":"","SQUAREFOOTAGE":"2,500 - 9,999","FIRM/INDIVIDUAL":"Firm/Business","PUBLIC/PRIVATEFLAG":"","PCCODE":"0 - 1 PCs","FRANCHISE/SPECIALTY#1":"","FRANCHISE/SPECIALTY#2":"","INDUSTRYSPECIFICCODES":"","ADSIZEINYELLOWPAGES":"Regular","YPSPEND":"UNKNOWN","METROAREA":"Anchorage, AK","INFOUSAID":"402622828"}],"sColumns":[{"mmData":"DateListProduced"},{"mmData":"RecordObsolescenceDate"},{"mmData":"Source"},{"mmData":"COMPANYNAME"},{"mmData":"ADDRESS"},{"mmData":"CITY"},{"mmData":"STATE"},{"mmData":"ZIPCODE"},{"mmData":"MAILINGCARRIERROUTE"},{"mmData":"MAILINGDELIVERYPOINTBARCODE"},{"mmData":"LOCATIONADDRESS"},{"mmData":"LOCATIONADDRESSCITY"},{"mmData":"LOCATIONADDRESSSTATE"},{"mmData":"LOCATIONADDRESSZIP"},{"mmData":"LOCATIONADDRESSDELIVERYPOINTBARCODE"},{"mmData":"LOCATIONADDRESSCARRIERROUTE"},{"mmData":"COUNTY"},{"mmData":"PHONENUMBER"},{"mmData":"WEBADDRESS"},{"mmData":"LASTNAME"},{"mmData":"FIRSTNAME"},{"mmData":"CONTACTTITLE"},{"mmData":"CONTACTPROFTITLE"},{"mmData":"CONTACTGENDER"},{"mmData":"ACTUALEMPLOYEESIZE"},{"mmData":"EMPLOYEESIZERANGE"},{"mmData":"ACTUALSALESVOLUME"},{"mmData":"SALESVOLUMERANGE"},{"mmData":"PRIMARYSIC"},{"mmData":"PRIMARYSICDESCRIPTION"},{"mmData":"SECONDARYSIC#1"},{"mmData":"SECONDARYSICDESCRIPTION#1"},{"mmData":"SECONDARYSIC#2"},{"mmData":"SECONDARYSICDESCRIPTION#2"},{"mmData":"CREDITALPHASCORE"},{"mmData":"CREDITNUMERICSCORE"},{"mmData":"HEADQUARTERS/BRANCH"},{"mmData":"YEAR1STAPPEARED"},{"mmData":"OFFICESIZE"},{"mmData":"SQUAREFOOTAGE"},{"mmData":"FIRM/INDIVIDUAL"},{"mmData":"PUBLIC/PRIVATEFLAG"},{"mmData":"PCCODE"},{"mmData":"FRANCHISE/SPECIALTY#1"},{"mmData":"FRANCHISE/SPECIALTY#2"},{"mmData":"INDUSTRYSPECIFICCODES"},{"mmData":"ADSIZEINYELLOWPAGES"},{"mmData":"YPSPEND"},{"mmData":"METROAREA"},{"mmData":"INFOUSAID"}]}
[/code]
Here's my initialization
[code]
$('#theData').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/ListView/SingleData/@Model.OrderId/1/1000"
});
[/code]
here's my debug link: http://debug.datatables.net/uyivex
Here's my JSON
[code]
{"sEcho":1,"iTotalRecords":1,"iTotalDisplayRecords":1,"aaData":[{"DateListProduced":"Sep 27 2013","RecordObsolescenceDate":"Mar 27 2014","Source":"Infogroup","COMPANYNAME":"1 800 Asphalt","ADDRESS":"15041 Old Seward Hwy","CITY":"Anchorage","STATE":"AK","ZIPCODE":"99516-3978","MAILINGCARRIERROUTE":"C018","MAILINGDELIVERYPOINTBARCODE":"418","LOCATIONADDRESS":"15041 Old Seward Hwy","LOCATIONADDRESSCITY":"Anchorage","LOCATIONADDRESSSTATE":"AK","LOCATIONADDRESSZIP":"99516-3978","LOCATIONADDRESSDELIVERYPOINTBARCODE":"418","LOCATIONADDRESSCARRIERROUTE":"C018","COUNTY":"Anchorage","PHONENUMBER":"9072774258","WEBADDRESS":"www.topasphaltcompany.com","LASTNAME":"James","FIRSTNAME":"Dena","CONTACTTITLE":"OWNER","CONTACTPROFTITLE":"","CONTACTGENDER":"Female","ACTUALEMPLOYEESIZE":"000000000016","EMPLOYEESIZERANGE":"10 to 19","ACTUALSALESVOLUME":"000006498000","SALESVOLUMERANGE":"$5 - 10 Million","PRIMARYSIC":"161101","PRIMARYSICDESCRIPTION":"Paving Contractors","SECONDARYSIC#1":"161101","SECONDARYSICDESCRIPTION#1":"Paving Contractors","SECONDARYSIC#2":"","SECONDARYSICDESCRIPTION#2":"","CREDITALPHASCORE":"B+","CREDITNUMERICSCORE":"086","HEADQUARTERS/BRANCH":"Single Loc","YEAR1STAPPEARED":"2010","OFFICESIZE":"","SQUAREFOOTAGE":"2,500 - 9,999","FIRM/INDIVIDUAL":"Firm/Business","PUBLIC/PRIVATEFLAG":"","PCCODE":"0 - 1 PCs","FRANCHISE/SPECIALTY#1":"","FRANCHISE/SPECIALTY#2":"","INDUSTRYSPECIFICCODES":"","ADSIZEINYELLOWPAGES":"Regular","YPSPEND":"UNKNOWN","METROAREA":"Anchorage, AK","INFOUSAID":"402622828"}],"sColumns":[{"mmData":"DateListProduced"},{"mmData":"RecordObsolescenceDate"},{"mmData":"Source"},{"mmData":"COMPANYNAME"},{"mmData":"ADDRESS"},{"mmData":"CITY"},{"mmData":"STATE"},{"mmData":"ZIPCODE"},{"mmData":"MAILINGCARRIERROUTE"},{"mmData":"MAILINGDELIVERYPOINTBARCODE"},{"mmData":"LOCATIONADDRESS"},{"mmData":"LOCATIONADDRESSCITY"},{"mmData":"LOCATIONADDRESSSTATE"},{"mmData":"LOCATIONADDRESSZIP"},{"mmData":"LOCATIONADDRESSDELIVERYPOINTBARCODE"},{"mmData":"LOCATIONADDRESSCARRIERROUTE"},{"mmData":"COUNTY"},{"mmData":"PHONENUMBER"},{"mmData":"WEBADDRESS"},{"mmData":"LASTNAME"},{"mmData":"FIRSTNAME"},{"mmData":"CONTACTTITLE"},{"mmData":"CONTACTPROFTITLE"},{"mmData":"CONTACTGENDER"},{"mmData":"ACTUALEMPLOYEESIZE"},{"mmData":"EMPLOYEESIZERANGE"},{"mmData":"ACTUALSALESVOLUME"},{"mmData":"SALESVOLUMERANGE"},{"mmData":"PRIMARYSIC"},{"mmData":"PRIMARYSICDESCRIPTION"},{"mmData":"SECONDARYSIC#1"},{"mmData":"SECONDARYSICDESCRIPTION#1"},{"mmData":"SECONDARYSIC#2"},{"mmData":"SECONDARYSICDESCRIPTION#2"},{"mmData":"CREDITALPHASCORE"},{"mmData":"CREDITNUMERICSCORE"},{"mmData":"HEADQUARTERS/BRANCH"},{"mmData":"YEAR1STAPPEARED"},{"mmData":"OFFICESIZE"},{"mmData":"SQUAREFOOTAGE"},{"mmData":"FIRM/INDIVIDUAL"},{"mmData":"PUBLIC/PRIVATEFLAG"},{"mmData":"PCCODE"},{"mmData":"FRANCHISE/SPECIALTY#1"},{"mmData":"FRANCHISE/SPECIALTY#2"},{"mmData":"INDUSTRYSPECIFICCODES"},{"mmData":"ADSIZEINYELLOWPAGES"},{"mmData":"YPSPEND"},{"mmData":"METROAREA"},{"mmData":"INFOUSAID"}]}
[/code]
Here's my initialization
[code]
$('#theData').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/ListView/SingleData/@Model.OrderId/1/1000"
});
[/code]
here's my debug link: http://debug.datatables.net/uyivex
This discussion has been closed.
Replies
Change the mData to be one of the strings in your JSON data and see if that fixes. (or output your JSON as integer-based arrays, not objects)
Reordering columns then continuing the server side post is going to be required so i think architecturally the best way to do that is to use name value pairs - let me know if not.
I'll give an array a shot and see if that works
Does the JSON objects feature work? Are there more examples anywhere?
Here's the initial code for my table..
[code]
@foreach (var header in Model.Header)
{
@header.Replace(" ", "")
}
[/code]
See http://datatables.net/blog/Extended_data_source_options_with_DataTables
Allan