Is is possible to hide a colum with an html class tag

Is is possible to hide a colum with an html class tag

NikkeNikke Posts: 8Questions: 0Answers: 0
edited April 2011 in General
My research on TableSorter plugin shows that I could put the following tag to stop a column being sorted
[code]
My col
[/code]

just wondering if I could do the same for hiding :)
[code]
My col
[/code]

Or am I being silly here? :)

Thanks a bunch!

Nikkie

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    The TableSorter syntax isn't picked up by DataTables automatically (no reason why a plug-in couldn't be written to do it, but there isn't one as far as I'm aware yet). However, it is possible to target columns with certain classes using DataTables and it's aoColumnDefs option: http://datatables.net/usage/columns . What you could do is have 'hidden' as the class on your TH element and you DataTables init like:

    [code]
    /* Using aoColumnDefs */
    $(document).ready(function() {
    $('#example').dataTable( {
    "aoColumnDefs": [
    { "bVisible": false, "aTargets": [ "hidden" ] }
    ] } );
    } );
    [/code]
    Allan
This discussion has been closed.