简体   繁体   中英

jquery datatables change td class for empty table

I'm using jquery datatables plugin. ( https://datatables.net/ ) I wanna know if there's a way to change the TD class when the tables is empty. From what I saw when there are no rows in table datatables inserts a row with a TD with class dataTables_empty . Is there way to change *dataTables_empty* to *myDataTables_empty* ?

I'm using fnRowCallback to change other rows classes... but it seems that this is not working for the auto inserted row when the table is empty.

you could change it using jQuery quite easily.

in your (document).ready handler...

$('.dataTables_empty').removeClass('dataTables_empty').addClass('myDataTables_empty');

Alternatively you could just use the default class name and override it in your CSS.

Otherwise, take a look at the datatables doco ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM