Multiple tables - How to add a row
Multiple tables - How to add a row
poldo93
Posts: 5Questions: 2Answers: 0
Good morning,
I'm working on multiple datatables created in one page, initialized by $('table.display').DataTable({opts})
How is it possible to add a row in one of the tables, supposing that each table has its own "add button"?
Thank you,
Paolo.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @poldo93 ,
You can either use jQuery selectors to access the tables independently still, or use the return from the initialisation. Hope this example helps - the page length is changed using both of those methods.
Cheers,
Colin
Thank you for the quick reply Colin!
I tried this solution: tables.table(1).row().add().draw( false );
An error message appear: "Cannot read property "nodename" of undefined"
Hi @poldo93 ,
I'm guessing it's because you're not passing in the row to add. It should be:
ROWDATA would either be an array or an object, depending upon your data - see here.
Cheers,
Colin
I thought that was possible insert an empty row, that was my error!
Many thanks again Colin!