Monday, July 13, 2015

FlexTable with static THEAD and TFOOT?

I am maintaining a pre-existing application that uses an MVC model with UIBinder and a FlexTable to display information. I am trying to update the display of the information into a single, properly formatted, semantically correct table. 

I basically have 3 elements that come into play and am looking for advice on how best to accomplish my goal. 

I have an "ElementPresenter" class (aka controller) and two ui.xml views (ElementView.ui.xml and ElementLineView.ui.xml) that render the final view. 

In my ElementPresenter class, I have a loadData() method that populates the two views.

private void loadData()
 
FlexTable table = ElementView.getElementFlexTable();
 table
.removeAllRows();
 
int row = 0;

 
for(DataLineProxy lineDTO :  data.getLines()){
   
final ElementLineView lineView = new ElementLineView();
   
//...populate some fields of lineView from lineDTO...
   table
.setWidget(row++, 0, lineView);
 
}

ElementView.ui.xml looks like this...

<g:HTMLPanel  ui:field="ElementView">
 
<!--Arbitrary HTML-->
 
<g:FlexTable ui:field="ElementFlexTable" />
 
<!-- Other HTML that I would like to include inside the ElementFlexTable and is populated via the loadData() method -->
</g:HTMLPanel>

And ElementLineView.ui.xml looks like this...
<g:HorizontalPanel>
 
<g:HTMLPanel>
   
<!-- HTML that defines some divs and a table that contains the fields to display the data from lineDTO -->
 
</g:HTMLPanel>
</g:HorizontalPanel>

This is what I'm trying to accomplish...I assume I would change ElementView.ui.xml to something like this
<g:HTMLPanel  ui:field="ElementView">
 
<table>
   
<thead>
     
<tr>
       
<th>Heading 1</th>
       
<th>Heading 2</th>
     
</tr>
   
</thead>
   
<tbody>
     
<!-- some GWT widget that renders as a TR???? -->
   
</tbody>
 
</table>
</g:HTMLPanel>

If I'm understanding correctly, all I need is a "widget" or "panel" that I can add other "widgets" to, correct? I've looked into using TableSectionElement for my <tbody> where I could then add TableRowElements and TableCellElements to it. That seems ideal but UIBinder is not compatible with TableSectionElement. 

Has anyone solved a problem like this? I keep searching for "gwt flextable static heading" but I keep seeing results of how to lock a table header in a scrolling view which is not what I am after here.

I find it difficult to believe that GWT does not provide a framework for including static content (e.g. headings? footers?) in a dynamically generated table. Most frameworks allow for this so I'm hopeful that I am just missing something. Someone please tell me that I'm missing something? It seems like I should be able to do something like this...

<g:FlexTable ui:field="foo">
<g:FlexTableHead>
<g:FlexTableRow>
<g:FlexTableCell>some content</g:FlexTableCell>
<g:FlexTableRow>
</g:FlexTable>

Do I need to use a Grid or CellTable, perhaps?

Please help :(



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment