Highlight Node before removing it
Highlight Node before removing it
![DawidGrzejek](https://secure.gravatar.com/avatar/79e6d71b986949d5dd8543cc73611b20/?default=https%3A%2F%2Fvanillicon.com%2F79e6d71b986949d5dd8543cc73611b20_200.png&rating=g&size=120)
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
This discussion has been closed.
Answers
You need to use
rows().nodes()
to get thetr
. E.g., rather than:Use:
Allan