Resolve error on first row
Resolve error on first row
neomaltine
Posts: 5Questions: 2Answers: 0
Hi !
I'm parsing a JSON and the first object is an empty one. I'm getting some errors sometimes. How can avoid inserting the first object in the table ?
Thank you !
This discussion has been closed.
Answers
you can use sDefaultContent property for aoColumns.
columns.defaultContent
is the camel case name for that property which is the one listed in the documentation.Allan
It doesn't solve my problem.
My json is an array of object, every object of that array contains sub-object but not the first object in the array. I'm returning data from the sub-object and I get an error on the first object which is empty and doesn't have a sub-object. How can I tell the library to ignore the first object in my json ?
PS: This empty object makes me an empty line in my table which is not pleasant.
I hope my explanation is clear :)
you should use mdata property for nested object.
I don't really understand I'm afraid. Can you post your JSON please.
Thank you for your answers, here is the structure of my json :
Of course I deleted some stuff for privacy, as you can see the first object is emtpy. I want to bypass this first element. The second element contains informations but here I removed them because of privacy.
I would suggest using
ajax.dataSrc
if you want to modify the data object that the server returns. Use something like:i.e. remove the first element from the array and then return the remaining array.
Allan