TableViewSelectionModel.getSelectedIndex returns value when no row is selected

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P4
    • 8u40
    • Affects Version/s: 8u25
    • Component/s: javafx
    • Environment:

      Windows 7, Eclipse Luna, jre1.8.0_25

      There seems to be a bug in the TableViewSelectionModel, though the javadocs don't help much on what is to be expected. However in the following code, if I select and then un-select (ctl-click) a row in a I get the following values for the following code:

      private TableView<Person> personTable;
      ....
              personTable.getSelectionModel().selectedItemProperty().addListener(
                      (observable, oldValue, newValue) -> showPersonDetails(newValue));
      .....
      int selectedIndex = personTable.getSelectionModel().getSelectedIndex(); // returns 5 in selectedIndex
      boolean rowSelected = personTable.getSelectionModel().isSelected(selectedIndex); // returns false to rowSelected

      I notice that even if you ctl-click to unselect a row, there is still an outline on the row. Hope this is enough info/contextually clear. Seems straight-forward enough.

            Assignee:
            Jonathan Giles
            Reporter:
            J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: