Highlight Node before removing it
Highlight Node before removing it
DawidGrzejek
Posts: 11Questions: 5Answers: 0
Hello,
I correctly remove a row from the table:
var table = $('#userAccountsTable').DataTable();
var s = id;
table.rows().nodes().each(function(a,b) {
if($(a).children().eq(0).text() == s){
table.rows(a).remove();
}
});
table.rows().invalidate();
table.draw();
But now I would like to highlight that row just before I remove it. I tried something like this:
var table = $('#userAccountsTable').DataTable();
var s = id;
table.rows().nodes().each(function(a,b) {
if($(a).children().eq(0).text() == s){
setTimeout( function () {
$(table.rows(a)).addClass( 'highlight' );
setTimeout( function () {
$(table.rows(a))
.addClass( 'noHighlight' )
.removeClass( 'highlight' );
setTimeout( function () {
$(table.rows(a)).removeClass( 'noHighlight' );
table.rows(a).remove();
}, 550 );
}, 800 );
}, 20 );
}
});
table.rows().invalidate();
table.draw();
But I cannot figure it out.
This question has an accepted answers - jump to answer
Answers
You need to use
rows().nodes()
to get thetr
. E.g., rather than:Use:
Allan