为多列应用唯一类 [英] Apply unique class for multiple columns

查看:18
本文介绍了为多列应用唯一类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为 Jquery 数据表中的每一列应用不同的类.我尝试在列定义中使用一些属性

How to apply different class for each column in Jquery data tables. I have tried using some properties in column definitions

$('#asset-table').DataTable({..... 
"columns": [
                                {
                                    "name": "claimNum",
                                    "title": "Claim#",
                                    "width": "11%",
                                    "type": "string",
                                    "data": "claimNum",
                                    "visible": assetDisplayColumns.indexOf("claimNum") != -1
                                },
                                {
                                    "name": "salvor",
                                    "title": "Salvage Provider",
                                    "width": "5%",
                                    "type": "string",
                                    "data": "salvor",
                                    "visible": assetDisplayColumns.indexOf("salvor") != -1
                                },.....

推荐答案

它使用了每列的 columsDefs 属性

It worked using columsDefs property for each columns

var assetTable = $('#asset-table').DataTable({
                        "columnDefs": [{ className: "makeItalic", "targets": [ 1,2,3 ] }, 
{ className: "makeBold", "targets": [ 4,5 ] }],....

这篇关于为多列应用唯一类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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