DataTables gives error when table is empty

DataTables gives error when table is empty

peterchchupeterchchu Posts: 3Questions: 0Answers: 0
edited October 2012 in DataTables 1.9
Using Datatables 1.9.4 for a Rails 3.2.6 Application.

Datatable is great but there is one slight problem. I had noticed that whenever my table has no data, it will give out the following errors:

[quote]DataTables warning (table id = 'resource-index-listing-table'): Requested unknown parameter '1' from the data source for row 0[/quote].

Can someone please help.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please provide a link to a page which shows this error so we can debug it, or run the table through the debugger.

    Allan
  • peterchchupeterchchu Posts: 3Questions: 0Answers: 0
    Thanks Allan, can you please tell me how to run the table through the debugger?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Instructions here: http://debug.datatables.net/ :-)

    Allan
  • peterchchupeterchchu Posts: 3Questions: 0Answers: 0
    edited November 2012
    Hi, I did and here is the code:

    asoruy

    Please let me know what is the reason for the alert?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You have a colspan in the table's tbody which is not supported by DataTables. That needs to be removed. Every column must have its own unique cell for each row (i.e. cells === rows * columns).

    Allan
  • ravishravish Posts: 10Questions: 0Answers: 0
    Hi you read the data from the some file using ajax request or read the data from the database as a result u just check the resp is empty or not by using (also trim the resp) .if its empty don;t pass to Datatable :)
This discussion has been closed.