JQuery Datatable Question: Centering column data after data insertion

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-16T23:53:18Z Indexed on 2010/05/17 0:00 UTC
Read the original article Hit count: 398

Filed under:
|
|
|

I have a data table that is initially empty and is populated after a particular Javascript call. After the data is inserted into the table, I'd like to center all of the data in one of the columns. I tried specifying this at the initialization step in this way:

dTable = $('#dt').datatable({ 'aoColumns': [ null, null, { "sClass" : "center" }] });

The data in the third column was not centered after the insertions were complete. I tried modifying aoColumns after the insertions and redrawing the table as well:

dTable.fnSettings().aoColumns[2].sClass = "center";
dTable.fnDraw();

This did not work either. So my question is simply how should I go about telling the data table to center the data in the third column?

Thanks in advance for your suggestions.

Chris

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui