style last column

style last column

propro Posts: 1Questions: 0Answers: 0
edited September 2009 in General
so i have a table where i want to style and disable sorting on the last column...so my table looks something like this..


[code]
FIRST NAME | LAST NAME | EMAIL | ACTIONS
peter | rabbit | prabbit@email.com | edit / delete
[/code]

actions column is my last column, where i'd like to edit or delete the record so i don't need to sort by this last column....and i'd also like to style it. but everything after is so not sure how i can select the last column.

any suggestions?

Replies

  • allanallan Posts: 61,439Questions: 1Answers: 10,052 Site admin
    Hi pro,

    Lots of options for the styling:

    1. You can use a CSS selector such as td:last-child { -last column styles- }, although it's not supported by IE...
    2. You could use jQuery with that selector to apply a class
    3. Use the sClass option in DataTables to add a class to the td element in that column - http://datatables.net/usage/columns#sClass
    4. Have the class in your HTML - DataTables will preserve it.

    Regarding disabled sorting, that's the bSortable option for the column: http://datatables.net/usage/columns#bSortable

    Regards,
    Allan
This discussion has been closed.