Request Parameter '0' from the data source for row 0

Request Parameter '0' from the data source for row 0

dtmnashdtmnash Posts: 6Questions: 0Answers: 0
edited October 2013 in General
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

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    I think you are right. Your JSON data is indexed by name-value-pairs, but your columndefs are specified by integer keys (i.e. mData: 0) instead of names (i.e. mData: "DateListProduced").

    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)
  • dtmnashdtmnash Posts: 6Questions: 0Answers: 0
    One other thing i noticed is that there is a discrepancy between what the datatables debugger is showing for my json and what I've noted above (taken from firebug) as my json.

    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
  • dtmnashdtmnash Posts: 6Questions: 0Answers: 0
    thought I would include a new debugger - I'm not understanding the issue - I've got everything setup as per the documentation for JSON objects.

    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]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > Does the JSON objects feature work? Are there more examples anywhere?

    See http://datatables.net/blog/Extended_data_source_options_with_DataTables

    Allan
  • dtmnashdtmnash Posts: 6Questions: 0Answers: 0
    thanks @allen! that article was extremely helpful! Everything is now working as expected!
This discussion has been closed.