0

I've got a ColumnConfig that I would like to render as a Yes/No rather than the default true/false.

I've tried converting the ColumnConfig from <M, Boolean> to <M, String> and the ValueProvider to return the Y/N String. This trips up the BooleanFilter.validateModel().

Is there a better way to keep the Boolean type but change the rendering?

Stevko
  • 4,345
  • 6
  • 39
  • 66

1 Answers1

1

Digging into the GXT source code, I noticed ColumnConfig has a Cell reference.

Adding a call to setCell() with a modified AbstactCell<Boolean> does the trick.

columnConfig.setCell( new AbstractCell<Boolean>() {

    @Override
    public void render(Context context, Boolean value,
        SafeHtmlBuilder sb) {
        if (value) {
            sb.append(SafeHtmlUtils.fromSafeConstant("Yes"));
        } else {
            sb.append(SafeHtmlUtils.fromSafeConstant("No"));
        }
    }
});
Stevko
  • 4,345
  • 6
  • 39
  • 66