Generated columns in datagrid not showing right values

The value for a generated column in datagrid not showing correctly,

image

the image above shows what is coming back. I tried with to generate a column with a buttonPanels and also tried with labels the way it was shown in the documentation just replacing the type.

DataGrid.Column column = dataGrid.addGeneratedColumn("loginUpperCase", new DataGrid.ColumnGenerator<EntityA, ButtonsPanel>(){
        @Override
        public ButtonsPanel getValue(DataGrid.ColumnGeneratorEvent<EntityA> event){

            Button viewBtn = uiComponents.create(Button.class);
            viewBtn.setAction(entityAView);

            Button editBtn = uiComponents.create(Button.class);
            editBtn.setAction(entityAEdit);

            Button removeBtn = uiComponents.create(Button.class);
            removeBtn.setAction(entityATableRemove);

            ButtonsPanel buttonsPanel = uiComponents.create(ButtonsPanel.class);
            if (opPermitted) {
                buttonsPanel.add(viewBtn, editBtn, removeBtn);
            } else {
                buttonsPanel.add(viewBtn, removeBtn);
            }
            return buttonsPanel;
        }

        @Override
        public Class<ButtonsPanel> getType(){
            return ButtonsPanel.class;
        }
    }, 1);
    column.setCaption("Login Upper Case");
}

regards,
Davia

Hi,

In order to display UI components, you need to set the ComponentRenderer for the DataGrid column, e.g.:

column.setRenderer(dataGrid.createRenderer(DataGrid.ComponentRenderer.class));
1 Like

@gorelov thank you