Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Scrolling</strong></p> <p>I won't dig deep into GWT with this post but I'll try to give some hints on how to do the scrolling part.</p> <p>If your table's data is wrapped in a separate tag than the table's body, then it shouldn't be a problem. If the table's structure is similar to the following, it shouldn't be a problem:</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;ColumnHeader1&lt;/th&gt; &lt;th&gt;ColumnHeader2&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;Data1&lt;/th&gt; &lt;th&gt;Data2&lt;/th&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>To make the data part vertically scrollable, you should add a CSS style to the <code>&lt;tbody&gt;</code> element which sets <code>overflow-y: scroll;</code> when the rowcount is greater than 15. Also you need to set the height or limit it's height by other means (wrapping container) for the scrollbar to appear.</p> <p>To set the height, I'd consider to get the <code>&lt;tbody&gt;</code>'s offset height right after the 15th row has been added and force it to stay at that. It might go like this:</p> <pre><code>tbodyElement.setHeight(tbodyElement.getOffsetHeight()); </code></pre> <p>Remember, this has to be done right after adding the 15th row.</p> <p><strong>Sorting</strong></p> <p>For that you should wrap your column header names in some kind of a <code>Widget</code>. It could be a <code>HTML</code> or a <code>Label</code> for example. You just need to add <code>ClickHandler</code>s to them and some styling to fill the whole cell and the cursor to switch to a hand with CSS <code>cursor: pointer;</code> while hovering on it.</p> <p><strong>Conclusion</strong></p> <p>Well, this was my light overview of this. Without seeing the code you've done it's hard to go any further.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload