Oops Null Pointer

Java programming related

Monthly Archives: November 2009

GXT Lockable Grid Columns

Due to the lack of this feature, I’ve hacked a rough version of a grid with lockable columns. It’s a starting point – a layout container with the target grid passed in and it creates a left hand side grid that contains the locked columns. Future enhancements would be to do all this in a GridView sub class, eliminating the separate class.

Updates here (V0.8).

Advertisements

GXT Grids – Enable text selection

In GXT the grids have text selection disabled by default (possibly for good reason). I haven’t found out any disadvantages to enabling text selection yet, so here is the code and go and copy and paste freely from grids to Excel…

final Grid<Stock> grid = new Grid<Stock>(store, cm);

grid.addListener(Events.Render, new Listener<BaseEvent>() {
    public void handleEvent(BaseEvent be)
    {
        grid.disableTextSelection(false);
    }
});

Update: I have seen some references to using:

grid.removeStyleName("x-unselectable");

Also in the newer versions of GXT I don’t think you need to add the listener any more (I haven’t confirmed this).