How to highlight that a new row has been added?
How to highlight that a new row has been added?
timcadieux
Posts: 76Questions: 22Answers: 0
I have a Table that has a rows.add() function that runs on a timer. I am able to successfully add the new data but I'd like to be able to highlight it, just for 1-2 seconds that something has changed, ie change the background css for the row and then reset it.
Ideas?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
http://jsbin.com/yifofu/edit?html,js,output
Thank you. I tried you jsBin and it worked but if I use the same on my version I get the following error.
I'm using version 1.10.12
** - JavaScript runtime error: Object doesn't support property or method 'select'
I have added
dataTables.select.min.js to my page
This logic depends on having https://datatables.net/extensions/select/ extension.
I updated the link http://jsbin.com/yifofu/29/edit to have two buttons now. The first button uses the logic shown above.
The second button does it just by adding then removing a class name as defined in the css panel. Normally, I try to avoid using the !important attribute, but in this case it is appropriate since the class will only be used for a few seconds.
A flaw in both solutions is that if you have paging, the row you add may get sorted out of view so some additional logic might be required to make the page that the row got sorted to the active page.
The Class version worked perfectly, thank you for helping me with this!