Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8194923

delete object from TableView moves the selection

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      openSUSE Tumbleweed (all patches applied)

      A DESCRIPTION OF THE PROBLEM :
      TableView using an ObservableList as data model. When an object is deleted from the list (selected in the TableView) the table will move the selection to another object. This is very frustrating if you are listening for changes and executing code accordingly.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      in any code fragment delete a selected object from a TableView model

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the row in the table should be deleted and there should be no new selection as a result
      ACTUAL -
      the row is deleted and the selection moves, usually I think, to the preceding line in the table triggering the action that is listening to the selected item property.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ObservableList list = FXCollections.observableArrayList();
      TableView table = new TableView(list);
      int x = table.getSelectionModel().getSelectedIndex(); // for example item 10
      list.remove(x);

      The selection will move to the preceding line in the table and trigger whatever listener is listening to the list or table.

      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: