Unable to get value of the property 'length'

Unable to get value of the property 'length'

MichaelPineMichaelPine Posts: 7Questions: 0Answers: 0
edited February 2013 in DataTables 1.9
Hey All

jQuery DataTables version 1.9.4

Stuck trying to work this one out, I am using an asp.net webapi call to return some data in the following format

[{"PropertyId":"4A468DE9-4D78-4AFE-A234-55E291D58505","LotNumber":"","Reference1":"","RefNumber1":"","StreetNumber":"115A","StreetNameAndType":"XXX","Suburb":"XXX","PostCode":"XXX"}]

I have commented out the actual values with XXX

Am I missing something ? or have I done something wrong, I normally return the json with a DataProp but because this is an API that might
be used my multiple applications I just want to return plain JSON

Table config is as below
oTable = $("#propertys").dataTable({
"sDom": '<"H"lrp>t<"F"i>',
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxDataProp": "",
"sAjaxSource": url,
"iDisplayLength": 20,
"sPaginationType": "full_numbers",
"bPaginate": true,
"bInfo": true,
"bLengthChange": false,
"bAutoWidth": true,
"assorting": "[]",
"aoColumnDefs": [
{
"bSortable": true, "aTargets": [12, 13, 14, 17, 18, 19, 20],
"bVisible": false, "aTargets": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
}
],
"fnDrawCallback": function (oSettings) {
}
});

Any help much appreciated when you get a chance.

cheers
Michael

Replies

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    > "bServerSide": true,

    and

    > "sAjaxDataProp": "",

    Are incompatible since there must be server-side processing parameters returned. The server-side processing documentation is here: http://datatables.net/usage/server-side . i.e. sEcho etc must be returned, so it can't possibly be an empty array only.

    Allan
  • MichaelPineMichaelPine Posts: 7Questions: 0Answers: 0
    Thanks Allen,

    no worries, I went back and changed my API so that it returns it as expected and all fine, not really a big deal, will just be part of the data that comes back in the response.

    cheers
    Michael
This discussion has been closed.