Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

update data in nested datatable

$
0
0

I use table with nested table: http://live.datatables.net/bihawepu/4370/edit
I update table like this:
var completetable = table.rows().data();

I check each elements

for (var i = 0; i < completetable .length; i++) {

If data id of object that needs to be updated is found in complete table:

if (completetable[i]._id + "" === data._id + "") {

update data in row with row index: table.rows()[0][i])

table.row(table.rows()[0][i]).data(data).draw()

When the nested table is opened (it shows '-' button on left of row) and when I update table, it changes the sign to + and still keep the nested table open. It changes data, but I want to keep the "-" as it was since nested table is opened.
I tried with such without success:
var tr = table.row(table.rows()[0][i]).child().closest('tr');
var tdi = tr.find("i.fa");
var row = table.row(tr);
row.child(format(row.data())).show();
tr.removeClass('shown');
tdi.first().removeClass('fa-plus-square');
tdi.first().addClass('fa-minus-square');


Viewing all articles
Browse latest Browse all 2364

Trending Articles