你沒有告訴dataTables你想jQueryUI渲染。這樣做是這樣的:
var table = $('#example').dataTable({
bJQueryUI: true
})
這指示數據表使用$.fn.dataTableExt.oJUIClasses
,否則 $.fn.dataTableExt.oStdClasses
使用(這是你的主要問題)
現在的等級順序是非常重要的。如果你想添加一個myClass
設置背景的一些其它顏色(這是你想要的):
$.fn.dataTableExt.oJUIClasses.sSortColumn = 'myClass sorting_';
如果你想跳過
sorting_x
完全
$.fn.dataTableExt.oJUIClasses.sSortColumn = 'myClass';
將導致myClass_1
,myClass_2
和等等。
$.fn.dataTableExt.oJUIClasses.sSortColumn = 'sorting_ myClass';
會把事情搞得一團糟。小演示 - >http://jsfiddle.net/f6qLqyao/
這裏是所有默認oJUIClasses類的完整列表:
sFilter: "dataTables_filter"
sFilterInput: ""
sFooterTH: "ui-state-default"
sHeaderTH: "ui-state-default"
sInfo: "dataTables_info"
sJUIFooter: "fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-bl ui-corner-br"
sJUIHeader: "fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-tl ui-corner-tr"
sLength: "dataTables_length"
sLengthSelect: ""
sNoFooter: "no-footer"
sPageButton: "fg-button ui-button ui-state-default"
sPageButtonActive: "ui-state-disabled"
sPageButtonDisabled: "ui-state-disabled"
sPaging: "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_"
sProcessing: "dataTables_processing"
sRowEmpty: "dataTables_empty"
sScrollBody: "dataTables_scrollBody"
sScrollFoot: "dataTables_scrollFoot ui-state-default"
sScrollFootInner: "dataTables_scrollFootInner"
sScrollHead: "dataTables_scrollHead ui-state-default"
sScrollHeadInner: "dataTables_scrollHeadInner"
sScrollWrapper: "dataTables_scroll"
sSortAsc: "ui-state-default sorting_asc"
sSortColumn: "sorting_"
sSortDesc: "ui-state-default sorting_desc"
sSortIcon: "DataTables_sort_icon"
sSortJUI: "css_right ui-icon ui-icon-carat-2-n-s"
sSortJUIAsc: "css_right ui-icon ui-icon-triangle-1-n"
sSortJUIAscAllowed: "css_right ui-icon ui-icon-carat-1-n"
sSortJUIDesc: "css_right ui-icon ui-icon-triangle-1-s"
sSortJUIDescAllowed: "css_right ui-icon ui-icon-carat-1-s"
sSortJUIWrapper: "DataTables_sort_wrapper"
sSortable: "ui-state-default sorting myClass"
sSortableAsc: "ui-state-default sorting_asc_disabled"
sSortableDesc: "ui-state-default sorting_desc_disabled"
sSortableNone: "ui-state-default sorting_disabled"
sStripeEven: "even"
sStripeOdd: "odd"
sTable: "dataTable"
sWrapper: "dataTables_wrapper"
你想排序功能或不是? –
是的,我想要排序功能留下來。我只是不想讓sorting_ *類隱藏我設置的行的背景顏色 –