Tony
Tony

Reputation: 1528

How to make GWT celltable cell not accepting click or focus

When I have a input such as a checkbox in the celltable cell, I noticed the cell actaully is clickable or focusable. If I click in the cell but outside of the checkbox, the cursor blinks there in the cell but ourside the checkbox. This behavior happens on all the cells with any inputs. or no inputs such as text only cell.

It is very anoying because, to toggle the checkbox, you have to click precisly on the little check box. Clicking anyware outside the checkbox but inside the cell will get the cell focused and cursor blinks there.

Any solutions?

below is an example of a checkbox rendered in a CellTable cell:

final CheckboxCell requiredCell = new CheckboxCell();
    Column<MyInfo, Boolean> requiredCol = new Column<MyInfo, Boolean>(requiredCell) {
        @Override
        public Boolean getValue(MyInfo info) {
            return info.isRequired();
        }
    };
    cellTable.addColumn(requiredCol, "Required");
    cellTable.setColumnWidth(requiredCol, 10, com.google.gwt.dom.client.Style.Unit.PCT);

Upvotes: 0

Views: 554

Answers (1)

Marconius
Marconius

Reputation: 713

You could add a click listener (or more precisely, a browser event listener that handles clicks) to your cell and just have it manually check the box.

Upvotes: 1

Related Questions