Ajax example help

Ajax example help

nandrainandrai Posts: 26Questions: 0Answers: 0
edited August 2013 in General
Having issue using the datatable and ajax combination

[quote]JJson response is below [/quote]

[code] {"aaData":[{"dateModified":"2013-07-31T20:22:03.043","ticketId":"2802662","dateOpened":"2013-07-31T20:22:03.043","siteId":"603107","status":"Open - Solving","address":"1 Bhongir Pkwy, Town and Country, 63017","subject":"BhongirStation Portal","priority":"3 - Medium","reportedBy":"Ryan Becker","dateClosed":"","type":"Incident","siteName":"BhongirStation Integration Testing"},{"dateModified":"2013-07-31T20:22:03.043","ticketId":"2802662","dateOpened":"2013-07-31T20:22:03.043","siteId":"603107","status":"Open - Solving","address":"1 Bhongir Pkwy, Town and Country, 63017","subject":"BhongirStation Portal","priority":"3 - Medium","reportedBy":"Ryan Becker","dateClosed":"","type":"Incident","siteName":"BhongirStation Integration Testing"},{"dateModified":"2013-07-31T20:22:03.043","ticketId":"2802662","dateOpened":"2013-07-31T20:22:03.043","siteId":"603107","status":"Open - Solving","address":"1 Bhongir Pkwy, Town and Country, 63017","subject":"BhongirStation Portal","priority":"3 - Medium","reportedBy":"Ryan Becker","dateClosed":"","type":"Incident","siteName":"BhongirStation Integration Testing"},{"dateModified":"2013-07-31T20:22:03.043","ticketId":"2802662","dateOpened":"2013-07-31T20:22:03.043","siteId":"603107","status":"Open - Solving","address":"1 Bhongir Pkwy, Town and Country, 63017","subject":"BhongirStation Portal","priority":"3 - Medium","reportedBy":"Ryan Becker","dateClosed":"","type":"Incident","siteName":"BhongirStation Integration Testing"},{"dateModified":"2013-07-31T20:22:03.043","ticketId":"2802662","dateOpened":"2013-07-31T20:22:03.043","siteId":"603107","status":"Open - Solving","address":"1 Bhongir Pkwy, Town and Country, 63017","subject":"BhongirStation Portal","priority":"3 - Medium","reportedBy":"Ryan Becker","dateClosed":"","type":"Incident","siteName":"BhongirStation Integration Testing"}]} [/code]


[quote]JDatatable code [/quote]

[code] $(document).ready( function () {
var oTable = $('#myTable').dataTable( {

"sAjaxSource": '${mainURL}',
"sServerMethod": "POST",

"aoColumns": [
{ "mData": "ticketId" },
{ "mData": "siteId" },
{ "mData": "siteName"},
{ "mData": "address" },
{ "mData": "reportedBy" },
{ "mData": "type"},
{ "mData": "status" },
{ "mData": "priority" },
{ "mData": "subject" },
{ "mData": "dateOpened" },
{ "mData": "dateClosed" },
{ "mData": "dateModified" }
],

"bScrollInfinite": true,
"bScrollCollapse": true,
"sScrollY": ($(window).height() - 350),

"oLanguage": {"sInfo": "Total records: _TOTAL_" }

} );//datatable


} );

[/code]

Replies

  • nandrainandrai Posts: 26Questions: 0Answers: 0
    I am getting the empty rows with out any data in the rows , not sure what is going on.

    but getting the following error

    [quote]
    Datatables warning( table id='myTable') : Requested unknown parameter '0' from the data source for row 0
    [/quote]
  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    Please link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read .

    It sounds like you have more columns in the HTML than you do in the aoColumns array. But without a test case, I'm guessing.

    Allan
  • nandrainandrai Posts: 26Questions: 0Answers: 0
    Thank you, I was using the wrong version.
This discussion has been closed.