Search code examples
gwtgxt

GXT 4.0 Hide TextButtonCell in an specific row in a Grid


I am using GXT4.0 / GAE 1.9.28 / GWT 2.7.

I created a grid, one of the columns is a TextButtonCell.

Here is the code of the button column:

    TextButtonCell bcDinamic_ = new TextButtonCell(){
        @Override
        public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {
            super.render(context, value, sb);

        }
    };

    bcDinamic_.setIcon(images.AspiEnTransito_24());
    bcDinamic_.setIconAlign(IconAlign.LEFT);

    colDinamic = new ColumnConfig<SerVisit, String>(new ValueProvider<SerVisit, String>(){

        @Override
        public String getValue(SerVisit visit) {
            return visit.getEstatus() + "|" + (visita.isRequerirConfirmacionVisita()?"1":"0")+ "|" + (visita.isRequerirControlEntradaSalida()?"1":"0") ;
        }

        @Override
        public void setValue(SerVisit object, String value) {
            // TODO Auto-generated method stub

        }

        @Override
        public String getPath() {
            // TODO Auto-generated method stub
            return null;
        }

    },180);
    colDinamic.setCell(bcDinamic_);
    configs.add(colDinamic);

I need to hide the button in some specific rows, according to its value.

I tried something like this:

        @Override
        public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {
               if (condition){              
                    super.render(context, value, sb);
               } else {
                    EMPTY:NO BUTTON!
                }
            }

It seems to work fine, but once in runtime, everytime the cursor highlight the row comes a error message:

Error (TypeError): Cannot read property 'contains' of null

In GXT 2 it was very easy to acomplish this, but now in GXT 4 I cant find a way.

Thanks


Solution

  • If anyone needs it, here is the ansewer to my question:

    https://www.sencha.com/forum/showthread.php?289876-HowTo-Disable-TextButtonCell&p=1064774&viewfull=1#post1064774