That's probably the best option, but be aware that the ".myStyleForTable td" selector will also select any td elements of any tables nested in your grid with the myStyleForTable class. Ideally, you'd be able to use "table.myStyleForTable > tbody > td", which restricts the match to direct sub-elements. Unfortunately, if I remember correctly, IE (at least 6, maybe 7, haven't tested 8) doesn't support those selectors.
-Brian On Dec 27 2009, 1:07 am, Prakash <[email protected]> wrote: > Hi, > you can use CSS selectors for applying styles for all cells in a > table. > > define a style for your table in css > > .myStyleForTable{ > > // Your table specific style. > > } > > .myStyleForTable td > { > align: left; > valign : top; > > } > > in your GWT code, apply above defined style to your table. > > Grid testGrid = new Grid(rows,cols); > testGrid.setStylePrimaryName("myStyleForTable"); > > In this way you need not to iterate every cell to apply style. > Hope this helps. > > Regards, > Prakash M. > > On Dec 26, 11:10 pm, Paul Grenyer <[email protected]> wrote: > > > > > Hi > > > On Fri, Dec 25, 2009 at 5:39 PM, Tristan <[email protected]> > > wrote: > > > I think you would need to create a css style like... > > > > .table-cell: { > > > align: left; > > > valign: top; > > > } > > > > but you wold still have to iterate through each one of your cells and > > > do addStyleName("table-cell") or something like that. because align > > > and valign could be different for <td>, <tr>, and <tbody>... so you > > > just have to specify what you really mean... just a hunch (not an > > > expert :) ) > > > Right! I see. That's a shame. I was hoping to be able to drop my subclass. > > > -- > > Thanks > > Paul > > > Paul Grenyer > > e: [email protected] > > b: paulgrenyer.blogspot.com -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
