Unable to select row by clicking on generated column

Hi.

I have generated a column in my table and it works fine, but when i try to select a row I cannot select it if the cursor is
inside that column. Any other column is fine.

The generate component is a CustomComponent having a HorizontalLayout as its compositionroot.

The component code looks like this:

public class JobStatusLabel extends CustomComponent {

    private final Label label = new Label();
    private final ProgressIndicator progressIndicator = new ProgressIndicator();
    private final Button buttonStop = new Button("Stop");
    private final HorizontalLayout layout = new HorizontalLayout();

    public JobStatusLabel() {

        progressIndicator.setVisible(false);
        progressIndicator.setWidth(100, UNITS_PIXELS);
        
        buttonStop.setVisible(false);
        buttonStop.setStyleName(Reindeer.BUTTON_LINK);


        label.setSizeUndefined();

        layout.addComponent(label);
        layout.addComponent(progressIndicator);
        layout.addComponent(buttonStop);
        layout.setComponentAlignment(progressIndicator, Alignment.MIDDLE_LEFT);
        layout.setSpacing(true);

        setCompositionRoot(layout);
    }

    public Label getLabel() {
        return label;
    }

    public ProgressIndicator getProgressIndicator() {
        return progressIndicator;
    }

    public Button getButtonStop() {
        return buttonStop;
    }

}

The generator code is like this:

private class StatusColumnGenerator implements Table.ColumnGenerator {

        public Component generateCell(Table source, Object itemId, Object columnId) {
            Item item = source.getItem(itemId);
            JobStatusLabel statusLabel = new JobStatusLabel();
            updateStatusLabel(item, statusLabel);
            return statusLabel;
        }
    }

Any idea why the click event is not propogated to the table?

Sounds like the same issue than discussed
here
. I’m afraid there’s no actual solution on offer there, though, but you might get some ideas on how to proceed. Of course if you settle on using plain labels etc the selection works like on non-generated columns, so you could perhaps divide the contents of your CustomComponent to different columns and avoid the problem that way.

Hi Anna.

Thank you for pointing me in that direction.
(I tried searching the forum first, but did not find the posts).

I might go down the road where I “hack” the event handling for the table, as splitting my content into several columns would not work UI-wise in my application.