With no data, how do I prevent an error when it expects something?
With no data, how do I prevent an error when it expects something?
Teonnyn
Posts: 10Questions: 1Answers: 0
I've got a working setup, however tables that don't have any data generally receive "{"data" : [] }" in response. This causes an output error, even though nothing is actually wrong. The output structure is used for all of my tables, so the number of columns could vary wildly, as well as naming. With these in mind, how can I modify the output so that DataTables will allow for no data?
This discussion has been closed.
Answers
DataTables should not throw an error if it receives an empty array. Can you link to a test page, showing the issue, as per the forum rules, so we can help to debug this please.
Allan
I figured it out in a sense, by creating some bogus data that just reads "empty: empty" when it finds nothing, and assigning defaults - no more errors at the moment!
While that may not be ideal, I'm using the basic code only at the moment