Blog

Tree Grid, Grouped Headers and Aggregation Rows - Ext GWT 2.0 M3 Released

June 15, 2009 | Darrell Meyer

The Ext team is pleased to announce the availability of Ext GWT 2.0 M3. M3 will be the last milestone release. We will be releasing a release candidate before the final release of Ext GWT 2.0. Many thanks to the early adopters in the community that have been using 2.0 and reporting bugs.

Ext GWT 2.0 M3 contains several new features and components.

Grid Enhancements

We have added two new features we hope you will enjoy. First is column grouping, which allows multi-row headers with colspan and rowspan support. In addition, widgets can be added to the headers. Column Grouping The follow code creates the two rows of column groups:
 
    cm.addHeaderGroup(0, 0, new HeaderGroupConfig("Header Grouping Example", 1, 5));
    cm.addHeaderGroup(1, 2, new HeaderGroupConfig("Stock Performance", 1, 2)); 
    cm.addHeaderGroup(1, 0, new HeaderGroupConfig(yourWidget, 1, 2));
 
The second enhancement is aggregation rows. One to many rows can be added to the bottom of a Grid. You can specify one of the predefined aggregations types, such as max, min, and avg, or use renderers to display any data. Aggregation Rows The following code creates a single aggregation row:
 
AggregationRowConfig<Stock> averages = new AggregationRowConfig<Stock>();
averages.setHtml("name", "Average");
 
// with summary type and format
averages.setSummaryType("last", SummaryType.AVG);
averages.setSummaryFormat("last", NumberFormat.getCurrencyFormat());
 
// with renderer
averages.setSummaryType("change", SummaryType.AVG);
averages.setRenderer("change", new AggregationRenderer<Stock>() {
  public Object render(Number value, int colIndex, Grid<Stock> grid, ListStore<Stock> store) {
    // you can return html here
    return number.format(value.doubleValue());
  }
});
cm.addAggregationRow(averages);
 

Tree Panel & Tree Grid

With the M3 release there are some exciting changes.

M3 introduces the TreePanel component. TreePanel binds directly to a TreeStore and replaces Tree, TreeItem, TreeBinder. Even more exciting, the new TreeGrid replaces TreeTable, TreeTableItem, and TreeTableBinder.

This new design gives you all the benefits and features of Grid - fast rendering, widget support, and inline editing - with the additional features of widget support previously found in Table. Grid now supports placing widgets in cells using a GridCellRenderer.

The following screenshot is of the new TreeGrid using a RowEditor:

TreeGrid

ImageBundle Support

ImageBundle support has been an often requested feature. With M3, we have added ImageBundle support. Icons can be specified in three different methods:
  • AbstractImagePrototype (typically from an ImageBundle)
  • CSS style name (existing method)
  • Image path (String)
All components that support icons now implement the new IconSupport interface:
/**
 * Interface for objects that support icons.
 */
public interface IconSupport {
  /**
   * Returns the icon.
   * 
   * @return the icon
   */
  public AbstractImagePrototype getIcon();
 
  /**
   * Sets the icon.
   * 
   * @param icon the icon
   */
  public void setIcon(AbstractImagePrototype icon);
 
  /**
   * Sets the icon style.
   * 
   * @param icon a CSS style name
   */
  public void setIconStyle(String icon);
}
In addition, there is a helper class, IconHelper, that can be used to create image prototypes from CSS style names, and image paths. Here is an example setting an icon 3 different ways:
 
    // from bundle
    item.setIcon(GXT.IMAGES.editor_bold());
    // CSS style name
    item.setIconStyle("my-icon");
    // image path
    item.setIcon(IconHelper.createPath("/my/url/foo.gif"));
 
When using ImageBundles, you create classes that extends ImageBundle. Here is a partial look of the new XImages class, which is the ImageBundle GXT uses for all it's icons:
 
public interface XImages extends ImageBundle {
  @Resource("hmenu-asc.gif")
  AbstractImagePrototype grid_sortAsc();
 
  @Resource("hmenu-desc.gif")
  AbstractImagePrototype grid_sortDesc();
  ....
}
 
One immediate benefit we have noticed, is that the icons display immediately when first displayed in the application, rather than incrementally as a page loads. This happens since all the images are combined into one on the server at compile time, and therfore, 1 http request. While we are talking about it, here is a sreenshot of the image GWT generates from the individual icons we specified in our XImage class:

Binders Deprecated

Ext GWT 1.0 included a set of "binders" classes that added store and model support to widgets. With the binders, you worked with stores and models, rather than widgets directly such as TreeItem's and TableItem's. With binders, there is the wrapped widget, the wrapped widget's child widget, and the binder itself:

  • Tree & TreeItem with TreeBinder
  • TreeTable & TreeTableItem with TreeTableBinder
  • Table & TableItem with TableBinder
  • DataList & DataListItem with DataListBinder
With 2.0, the "binders" and their wrapped widgets have been deprecated. Don't confuse "binders" with our data binding code, which is something different. As mentioned above, Tree, TreeItem, TreeBinder TreeTable, TreeTableItem, and TreeTableBinder have been deprecated. In addition, DataList, DataListItem, and DataListBinder have been deprecated in favor of the existing ListView component which binds directly to a ListStore. With these changes, all of our data bound components have the same design, using stores and models. There are equivalents to every function and feature the deprecated functions provided, so there's a smooth upgrade path.

Upgrading

Ext GWT 2.0 is a major upgrade from 1.0. There are a number of breaking changes to consider when moving from 1.X. There is a migration guide in the Ext GWT download which documents the API changes. Make sure to take a look at this before you begin upgrading to 2.0.

We are offering a pre-release sale with hefty discounts to upgrade your 1.x license. If you've thought about purchasing an Ext License, for a limited time, you can purchase online for less than an Ext GWT 1.x License. There's no better time to support the Ext team.

Written by Darrell Meyer
Darrell Meyer leads the Sencha GXT product team at Sencha. Before joining the company, Darrell was the creator of the popular open source MyGWT Widget Library for Google Web Toolkit (GWT). Darrell brings his expert Java and GWT knowledge to Sencha. With 10+ year’s experience building enterprise web applications, Darrell is equally well versed as both a software architect and user interface expert.
Follow Darrell on Twitter

Share this post:
Leave a reply

There are 35 responses. Add yours.

Shea Frederick (VinylFox)

3 years ago

Love the grouped headers and bundled images - nice work Darrell!

Ivan

3 years ago

I’d love to see this enhancements in ExtJS as well!

Rvanlaak

3 years ago

Thanks for the quick replies on the bugs wich i’ve commited!

The 2.0 releases are a big step in the maturity of the library.

Jay Garcia

3 years ago

Good lord this is sweeeeeeeeeeeeet.

Ates Goral

3 years ago

Column grouping and row aggregation are what we have been waiting for!

Mark Price

3 years ago

Wow.

sqtz

3 years ago

Imagebundle support at last!! grin (i have been asking this since the old mygwt days)

zc

3 years ago

??ext??????????????

Stefan Klinger

3 years ago

Still missing the column reorder feature which was promised as part of 2.0 release!!!

Jay

3 years ago

Simply stunning guys.

Sumit

3 years ago

Column grouping, row aggregation and bundled images are not included in the regular ExtJS javascript library. I thought ExtGWT was a layer above the ExtJS javascript library API?

Boubalou

3 years ago

Same for us, Ates!

This is a hell of a nice release.

Sven Brunken

3 years ago

“I thought ExtGWT was a layer above the ExtJS javascript library API?”

No, Ext GWT is a Widget library on top of GWT. It is completly written in Java and has no part of the Ext JS library in it.

Sven

Kiko

3 years ago

Please make it also available for ExtJS!

PT LUI

3 years ago

Great Work! I love GXT

Denis

3 years ago

Hi, I’m sure that you know but I want to mention that, in Slate theme, RowEditor’s Save Cancel buttons’ text are not displayed before clicking to them. smile If this is not the place for writing bugs, I’m sorry smile
PS: I love all new widgets and attributes, they are great, thanks.

Praveen Ray

3 years ago

What? these goodies are not in regular extjs?

Kevin

3 years ago

Very Impressive.  I really enjoyed playing with the examples.  Nice work.

wayne-o

3 years ago

You can implement the grouped headers etc in ExtJs using the plugins - though - they do tend to be slightly buggy in some instances - and for this reason I think it would be excellent if the ExtJs team put some work into turning some of the plugins into supported extensions to the framework.

Things like grouped headers, multi levels of grouping, group summaries/headers etc make this framework a real gem - it’d be amazing if these plugins were made more solid-less buggy.

w://

elfer

3 years ago

GWT???????GA?????

Francesco

3 years ago

Fantastic work as ever guys!

Would it be possible to add a row header and aggregation columns with the same functionalities of the column grouping headers and the aggregation rows you have implemented? The row header should be able to span across multiple rows (on the left before the “data” area) and also allow colspan and rowspan support…

Keep up the good work!

Vince Pell

3 years ago

Please make the Tree Grid a component in ExtJs.

Homer

3 years ago

“Please make the Tree Grid a component in ExtJs.”

count me in on that!

» Ext GWT 2.0 M3 ??? ????

3 years ago

[...] ?????http://extjs.com/blog/2009/06/15/tree-grid-grouped-headers-and-aggregation-rows-ext-gwt-20-m3-releas… ext ext   ??? Java/?????. Tags: Ext. [...]

Dave Blickstein

3 years ago

“I thought ExtGWT was a layer above the ExtJS javascript library API?”

That’s GWT-Ext, not Ext-GWT.

The confusion is, of course, understandable.

kabin

3 years ago

kabin üretim ve sat??.

LivingLegends

3 years ago

TreeGrid doesn’t support expanding/collapsing nodes using keyboard.
How to deal with it?

Sven Brunken

3 years ago

“TreeGrid doesn’t support expanding/collapsing nodes using keyboard.
How to deal with it?”

This feature was already added in SVN.

ExtJs Continues to Push the Web Forward | _mindMel

3 years ago

[...] ExtJs recently posted a blog entry detailing some new features for Ext GWT. Certainly these new features are also in plain ole ExtJs. Here are some screenshots, but read the blog entry for more details:Ext JS – Blog [...]

Home games

2 years ago

How to deal with it?

Aravind

2 years ago

How can we crate tree grid like
http://www.extjs.com/deploy/dev/examples/treegrid/treegrid.html

using EXT GWT ?

Bermain Permainan

2 years ago

Hi Aravind,

There is an example in http://www.extjs.com/examples/pages/treegrid/basic.html

and I think you could add some widget to columns like checkbox.

??

2 years ago

I thought ExtGWT was a layer above the ExtJS javascript library API

Hanson

2 years ago

I want a treegrid with roweditor, where the javascript row editor class for treegrid?

Comments are Gravatar enabled. Your email address will not be shown.

Commenting is not available in this channel entry.