Adding jQuery UI class to td

Adding jQuery UI class to td

ChrisGedrimChrisGedrim Posts: 10Questions: 0Answers: 0
edited May 2011 in General
Allan,

Is there any reason why you don't add a jQ UI class to td tags? (ui-widget-content & fg-widget-content for example)

I feel that it gives the table a more consistent feel. Whilst I know I could manually add the class in a couple of different ways:

[code]
var oTable = $('table').dataTable({
'fnDrawCallback': function(){
$('td').addClass('ui-widget-content')
}
});
[/code]

[code]
var oTable = $('table').dataTable({
"aoColumns": [
{ "sClass": "ui-widget-content" },
{ "sClass": "ui-widget-content" },
{ "sClass": "ui-widget-content" }
]
});
[/code]

would it not be better to add these classes in core when the rest of the UI classes are added?

-- Chris

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Yes this isn't done by default because it's quite a slow process to add a class in that manner (tables with 10000 cells for example would take too long), and as you note it's a trivial one liner to add in Javascript ($('td').addClass...), or a simple thing to add in CSS which will be much faster all round :-)

    Allan
This discussion has been closed.