Could someone help me in setting the background of a CellTable row
please, I've been trying all night to do it and keep failing and it's
driving me mad. I've tried using a call to setRowStyles()
but that
doesn't seem to be working and I've read that you can't change the
style for a CellTable once a style has been set - as the default one
is set.
Then I tried constructing a CellTable with my own interface
CellTableResources as seen on a post on this exact subject BUT that
gave me error messages about unobfuscated ccs elements.... which my
css not being obfuscated is an obvious error message.
Now I don't know what to try and I am officially STUCK.
I've been reading about this @external and it didn't seem to help... not even sure where the external bit is supposed to go... I guess in the css but as usual with when stuck I'm trying anything!
TonyK
I know how frustrating this can be, I've been in the same place. I've included all the steps that I used to get this working. But it sounds like you are almost there, so you will probably not need all of these.
As you mentioned to use your own css class names you must implement com.google.gwt.user.cellview.client.CellTable.Resources and pass an instance of your class to the CellTable constructor.
CellTable Declaration
The implementation of Resources also requires an instance of com.google.gwt.resources.client.ImageResource and com.google.gwt.user.cellview.client.CellTable.Style, the class that will provide your css class names. To make things simple here are stub implementations of Resources, ImageResource, and Style that do nothing but provide strings as style names. In the end these can come from ClientBundle but it is not a requirement.
Style Stub (Using String Literals)
ImageResource Stub
Resource Stub
So, at this point you should have a Cell Tabula Rasa with no style and you should be able to inspect your CellTable element in the browser and see myCssClassName as the ubiquitous CSS class name, unobfuscated.
If at this point you link to a style sheet using one of the traditional methods you should be able to set the "myCssClassName" Strings to correspond with your specific style sheet.
Style Sheet Link
Now, if you want to inject your styles using ClientBundle you have a few additional steps.
First, be sure that you are injecting your style sheet at some point; this is real easy to forget. A simple place is in your module's EntryPoint that way you can be sure it is being called.
CssResource Injection
Finally use your CssResource to provide the names to the Style implementation from earlier. Whether or not the CSS class names are being obfuscated they should be injected and using the correct name this way.
ClientBundle Stub
CssResource Stub
Style Sheet Stub
Style Stub (Using ClientBundle)
That should be it. I'm sure there are other ways to do the same thing but this has worked well for me so far. Good luck and I hope this saves you some time.