jQuery UI themed rows?

jQuery UI themed rows?

KasreynKasreyn Posts: 4Questions: 0Answers: 0
edited January 2011 in General
I like how easy it is to support jQuery UI themes in DataTables but have come across a problem.

Changing theme from one with a very dark background to a light one can sometimes make the text unreadable.

To solve this I have added some of the generic jQuery UI classes to "sStripOdd" and "sStripEven":

"sStripOdd": "odd ui-widget-content",
"sStripEven": "even ui-state-default",

I really only wanted the background property of those classes but couldn't find a suitable property. Maybe this will change in the future for jQuery UI themes.

Also I couldn't find any public properties available for setting "sStripOdd" and "sStripEven" ?

If anything maybe someone can suggest a better way of getting the same result ?

Replies

  • KasreynKasreyn Posts: 4Questions: 0Answers: 0
    edited January 2011
    Using the jQuery ui-classes is just a temporary fix. I think the best way would be to get the background of ui-widget-content and then modify the rgb to be slightly darker/lighter and set that for odd/even. This way the text would always be readable.

    But I havn't found a way to access dynamicly loaded css in a sane way. $(".ui-widget-content").css("background") will return "" and not the colorhex as it consists of more than one component.
  • KasreynKasreyn Posts: 4Questions: 0Answers: 0
    Found a much simpler solution. First remove all css for odd/even rows then set the alpha value like this:

    tr.odd {
    background: rgba(0,0,0,0.2);
    }

    tr.even {
    background: rgba(0,0,0,0.1);
    }

    http://robertnyman.com/2010/01/11/css-background-transparency-without-affecting-child-elements-through-rgba-and-filters/
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    You can also use the asStripClasses option ( http://datatables.net/usage/options#asStripClasses ) to customise the class names that are using for the odd / even striping if you want.

    Allan
This discussion has been closed.