jquery datatables设置每列不同的颜色

html代码如下,主要通过设置aoColumnDefs的属性, aTargets表示具体哪一列。希望对大家有用啊,自己也是查了好多外文网站,最后才搞定这种办法

引用常用的库是:

<script type="text/javascript" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.jeditable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>

<style>		
	.col_class{
				color:#FFFFFF;
			}
			.cos_class{
				color:#F5F683;
			}
</style>

  



<script type="text/javascript" language="javascript"> function InitOverviewDataTable(urlss) { oOverviewTable =$('#district1').dataTable( { "bPaginate": false, "bJQueryUI": false, "bLengthChange": false, "bFilter": false, "bSort": false, "bInfo": true, "iDisplayLength": 10, "bAutoWidth": true, "sAjaxSource": urlss, "oLanguage": { "sProcessing": "正在加载中......", "sEmptyTable": "无数据", "sInfo": "" } , //多语言配置 "aoColumnDefs":[ {"sClass":"col_class","aTargets":[0]},{"sClass":"cos_class","aTargets":[1]}] }); } </script> <table cellpadding="0" cellspacing="0" border="0" class="display" id="district3" bgcolor="#000000"> <thead> <tr> <th></th> <th></th> </tr> </thead> </table>

 

  

你可能感兴趣的:(jquery datatables设置每列不同的颜色)