4

I want to completely view updates when a row is selected in a CellTable. How can this be done? In the following test case, using NoSelectionModel, the view is still updated: clicking on a row changes the background and border colors of the row until another row is clicked.

    CellTable<String> table = new CellTable<String>();

    TextColumn<String> column = new TextColumn<String>()
    {
        @Override
        public String getValue(String string)
        {
            return string;
        }
    };

    table.addColumn(column);

    List<String> sampleData = Arrays.asList("foo", "bar", "baz");

    table.setRowData(sampleData);

    final NoSelectionModel<String> selectionModel = new NoSelectionModel<String>();
    table.setSelectionModel(selectionModel);

    RootPanel.get().add(table);

I've also attempted to subclass SingleSelectionModel with empty override methods, without success.

I can fake the behavior I want by providing empty CSS stylings for selected rows, but that method seems hack-ish.

Community
  • 1
  • 1
cqcallaw
  • 1,463
  • 3
  • 18
  • 29
  • 1
    What you're seeing is the keyboard-selection highlighting (really useful when you're not using the mouse to interact with the table), maybe you can try tweaking the keyboard selection policy? – Thomas Broyer May 04 '12 at 22:51
  • Awesome, setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED) does the trick. Care to write that in an answer so I can flag this question as answered? – cqcallaw May 05 '12 at 00:24

1 Answers1

13

What you're seeing is the keyboard-selection highlighting (really useful when you're not using the mouse to interact with the table).
You can disable it using setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED)

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164