Search code examples
javagwtgxt

Ext GWT 2 - Group grid rows


Is it possible to group Grid rows by column values?

For example I have this ModelData:

    ModelData model = new BaseModelData();

    Map<String, String> data = new HashMap<String,String>();
    data.put("Date", "20:55:06");
    data.put("Service", "1001");
    data.put("IP", "127.0.0.1:5003"); 
    data.put("Status", "Good");
    data.put("Code", "0200");

    for (Entry<String, String> entry: data.entrySet()) {
        model.set(entry.getKey(), entry.getValue());
    }

And I have a List<ModelData> which is rendered to a Grid, and what I need is to group rows in the Grid having the same "IP", "Status" and "Code" for example.


Solution

  • You can group items in Ext GWT 2 Grids as shown here.

    You need to create an instance of the GroupingView class as pass it to your Grid.

    If you don't need to display the Group headers then just sort the ModelData objects before adding them to the Grid.