Search code examples
javagwtgxt

GXT Column header, override default labels


There is a default menu in GXT for column config which holds sorting options etc:

enter image description here

I'm digging the interwebz on how to override these labels. Not the menu stucture or the behavior, just the labels (there is a submenu called Filters -> Yes, No, where I have to replace Yes, No with Up, Down). I found this post: http://www.sencha.com/forum/showthread.php?90713-Grid-Column-Header-Menu but this is basically overriding and custom implementing the whole menu, which is overkill. Thanks in advance!

Update: I'm prividing the accepted answer here:

    BooleanFilter<?> statusFilter = new BooleanFilter<?>(...);

    statusFilter.setMessages(new BooleanFilter.BooleanFilterMessages() {
        @Override
        public String noText() {
            return "Down";
        }

        @Override
        public String yesText() {
            return "Up";
        }
    });

    filters.addFilter(statusFilter);

Solution

  • The "Yes" and "No" text in the BooleanFilter comes from BooleanFilterMessages, which by default reads from XMessages.booleanFilter_noText and XMessages.booleanFilter_yesText. You can pass a BooleanFilterMessages instance to BooleanFilter.setMessages with your custom text.

    Or, if you want to override it everywhere, you can place a XMessages.properties file in the correct path, com/sencha/gxt/messages/client/, and change the keys listed above.