adding rows to a table dynamically and then getting the added rows
adding rows to a table dynamically and then getting the added rows
vysh
Posts: 1Questions: 0Answers: 0
I am using this code to create a table
[code]
oTable = $('#table_id').dataTable();
[/code]
and then using [code] fnAddData() [/code] to add rows to it dynamically.
The requirement is to allow users to add multiple rows and then save the added rows on click of a "Save" button.
For getting the rows, I am using [code] fnGetNodes() [/code], but this does not return the dynamically added rows.
My guess is that since new rows are not written on to the HTML, so the Datatable API is not able to get the rows.
Any idea how I can get the entire table (old as well as dynamically added rows) ??
Any help would be greatly appreciated.
[code]
oTable = $('#table_id').dataTable();
[/code]
and then using [code] fnAddData() [/code] to add rows to it dynamically.
The requirement is to allow users to add multiple rows and then save the added rows on click of a "Save" button.
For getting the rows, I am using [code] fnGetNodes() [/code], but this does not return the dynamically added rows.
My guess is that since new rows are not written on to the HTML, so the Datatable API is not able to get the rows.
Any idea how I can get the entire table (old as well as dynamically added rows) ??
Any help would be greatly appreciated.
This discussion has been closed.
Replies
[code]
var data = oTable.fnGetData(this);
[/code]
where 'this' can be replaced with a rowid, or a tr, or left out completely to get the whole table,
try here: http://datatables.net/ref#fnGetData
I am also using fnAddData to create dynamic rows ,but I want text box,checkbox and button in columns of dynamically generated rows. Is it possible to do so ?
Allan