add blink effect just for new rows
add blink effect just for new rows
Dear all,
I'm using "DataTables plug-in" to make HTML table,
and "WebSocket protocol" to add new rows.
[code]
var s = new WebSocket("ws://lalala:9876/");
s.onmessage = function(e) {
fnAddRow(e.data);
}
var new_rows=[[row1],[row2]]
function fnAddRow(new_rows) {
$('#example').dataTable().fnAddData(new_rows);
}
[/code]
It works fine, but I'd like to add blink effect just for the new rows!
I'l try with this
[code]
oTable = $(tableName).dataTable( {
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$(nRow).blink({blinks:2,speed:500});
});
});
[/code]
but every time that there is a new row or I perform a search it adds blink effect to all rows.
You cen see the test page to this adress:
http://condb.web.cern.ch/condb/popcon/PopConRecentActivityRecorded.html
and click "Click to add a new row" button to simulate WebSocket.send(message).
Best regards,
Antonio
I'm using "DataTables plug-in" to make HTML table,
and "WebSocket protocol" to add new rows.
[code]
var s = new WebSocket("ws://lalala:9876/");
s.onmessage = function(e) {
fnAddRow(e.data);
}
var new_rows=[[row1],[row2]]
function fnAddRow(new_rows) {
$('#example').dataTable().fnAddData(new_rows);
}
[/code]
It works fine, but I'd like to add blink effect just for the new rows!
I'l try with this
[code]
oTable = $(tableName).dataTable( {
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$(nRow).blink({blinks:2,speed:500});
});
});
[/code]
but every time that there is a new row or I perform a search it adds blink effect to all rows.
You cen see the test page to this adress:
http://condb.web.cern.ch/condb/popcon/PopConRecentActivityRecorded.html
and click "Click to add a new row" button to simulate WebSocket.send(message).
Best regards,
Antonio
This discussion has been closed.
Replies
When you do your fnAddData - save the return value. It's an array with the cached indexes of the row that was added. Then you can do something like:
[code]
var oTable = $('#example').dataTable();
var a = oTable.fnAddData(new_rows);
var nTr = oTable.fnGetNodes( a[0] );
$(nTr).blink({blinks:2,speed:500});
[/code]
It can be tided up and bit of course, and shunted around - but that's the general idea :-)
Allan
now, it works very nice.
Thank you very much for your help.
Antonio