Results 1 to 2 of 2

Thread: Extended grids

  1. #1
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Vote Rating


    Hi all,

    We use many grids to show customer's data in our application. And GXT grid control proved to be very useful and handy.

    But there are some cases when the way it's being rendered should be changed.

    Image grid_0.png shows a normal grid:

    But sometimes it should be shown like on image grid_1.png:

    Or even like on grid_2.png:

    In other words cells of one row can be folded into several subrows.

    In order to support this a customized GridView is created. It overrides GridView behavior when
    - column headers are rendered (only columns of first subrow should be shown)
    - grid total width is calculated (some column headers should not be shown)
    - row is rendered into html (more than one tr-elements should be created)
    - Javascript Element object is determined (cause number of tr-elements has been changed, otherwise onClick will work correctly for first subrow only)

    At the moment this approach is implemented as a patch for GXT 2.0.4 (see attached archive).
    Besides CustomGridView it contains slighly patched ColumnHeader class (just a method getColumnCount() is added so that it can be overrided by CustomGridView).

    CustomGridView has two properties:
    - int[] subrowLength (array of subrow lengths)
    - int[][] colSpan (some columns can be extended to 2 and more subrows)

    So for use cases shown above one should type:

    - grid_1.png
    result.setView(new CustomGridView(new int[]{3, 2}, new int[][]{{0,2}}));
    (first subrow consist of 3 columns, the second subrow consists of 2 columns, first column occupies 2 subrows)

    - grid_2.png
    result.setView(new CustomGridView(new int[]{4, 1}, new int[][]{{0,2}, {2,2}, {3,2}}));

    For sure API is not perfect and array things can be changed to whatever else.

    I guess that more people than me and my colleagues need such folded grids.

    So could you please consider if they can be included into next GXT release. TIA
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Ext User
    Join Date
    Sep 2008
    Vote Rating


    my 2 cents:

    1) the definition is very confusing on the first time ... it should be more easy more easy to define the rowlayout. the verb colspan means in html a different thing.
    2) patching the columnheader is not a good idea. better make the CustomGridview in that way that it can be easy drop in whithout patching existing classes.
    This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.

    GreaseMonkey Script for a GXT-only Forum: it hides ExtJs here: New Posts Search Results Advanced Search form Category overview

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts