Re: Need to style DataGrid's header element

Tue, 26 Jun 2012 14:46:32 -0700

Thanks for the recommendation. This solved my problem.

On a related note, I'm providing my own Resource implementation:

public interface DataGridResources extends DataGrid.Resources {
    @Override
    @Source({ "WorksheetDataGrid.css" })
    DataGrid.Style dataGridStyle();
} 

This works well, with the exception that the widget seems to not use 
the dataGridWidget style class. It simply doesn't show up anywhere in the 
output. I'd think the outermost element in the HTML would reference this 
style class. Is this a bug or am I doing something wrong?

On Friday, June 22, 2012 3:57:39 AM UTC-5, Thomas Broyer wrote:
>
>
>
> On Friday, June 22, 2012 4:46:00 AM UTC+2, Joseph Lust wrote:
>>
>> Jeremy,
>>
>> A less than glamorous way to apply CSS changes that are either not 
>> exposed, or not supported (i.e. CSS3) are to do it yourself at load time.
>>
>> For example, in the constructor (if you're extending) or directly after 
>> the instantiation of your DataGrid, walk its DOM and get that <th> element 
>> you're looking for and apply that CSS style explicitly 
>> (element.setAttribute("border-collapse","collapse")).
>>
>
> Yes, 
> getTableHeadElement().getParentElement().getStyle().setProperty("borderCollapse",
>  
> "collapse"); should do it.
> (you'd probably have to do it for getTableBodyElement().getParentElement() 
> too to make sure the tables are aligned).
> And because those methods are protected, you have to extend DataGrid, or 
> call them through JSNI to bypass access control.
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/gtVss-WNoYMJ.
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.

Reply via email to