如何在数据表的jquery中更改特定的列背景颜色 [英] How to change a particular column background color in jquery of a datatable

查看:74
本文介绍了如何在数据表的jquery中更改特定的列背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是Jquery的新手,所以有人能告诉我,如何在加载数据表的jquery时更改特定的列背景颜色?



plz帮帮我..

Hi,

i''m new to Jquery,so can anyone tell me ,How to change a particular column background color in jquery of a datatable while loading?

plz help me out..

推荐答案

我会说更好的选择是使用内置的jquery数据表功能将样式类应用于该列,然后使用css设置该类的背景颜色。



I''d say a better option is to use the inbuilt jquery datatable feature to apply a style class to that column and then simply use css to set the background color for that class.


(document).ready(function(){
(document).ready( function() {


(''#example'')。dataTable({
aoColumnDefs :[
{sClass:my_class,aTargets:[0]}
]
});
});
(''#example'').dataTable( { "aoColumnDefs": [ { "sClass": "my_class", "aTargets": [ 0 ] } ] } ); } );





编辑:因为你想要第4列,因为''aTargets''参数是基于0的,只是为了论证,如果你想要更多列,也就是6号和8号,然后



Since you want the 4th column, and since the ''aTargets'' parameter is 0-based, and just for arguments sake, if you wanted for more columns, say the 6th and 8th too, then


这篇关于如何在数据表的jquery中更改特定的列背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆