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):
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
Post a Comment