javascript - Datatables add a new row with alignment as center -


i have html page method create , display datatable:

<script type="text/javascript" language="javascript" class="init"> var table; var socket; $(document).ready(function() {           table = $('#example').datatable(); socket  = io.connect('http://127.0.0.1:80'); socket.on('message', function (data) { var rownode = table         .row.add( [ data.id, data.name, data.dispensed, data.amt, data.balance, data.ppm, data.avail] )         .draw()         .node();  $( rownode )     .css( 'color', 'red' )     .animate( { color: 'black' } );     } ); });  </script> 

the scripts gets called when backend scripts in nodejs sends message on web socket. issue data displayed in table not center aligned in temporary row (new data - color red, old temp data - black):

enter image description here

is there way can center align values?

try adding alignment part of .css in following block:

$( rownode )     .css( 'color', 'red';text-align:center )     .animate( { color: 'black' } );     } ); 

for more alignment related css properties check link


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -