java - Event Handler when a Row is deleted from Table View -


i need know how catch event happens when row deleted tableview , index of row. @ moment when row deleted table view tableview.getselectionmodel().clearselection() method called. want select last index available in table view.

tableview.getselectionmodel().clearandselect() not option, because row deleted automatically.

regards

for table type, example, person:

import javafx.collections.listchangelistener.change ;  // ....  tableview<person> table = ... ;  table.getitems().addlistener((change<? extends person> c) -> {     while(c.next()) {         if (c.wasremoved()) {             int numremoved = c.getremoved().size();             int index = c.getfrom();             system.out.println(numremoved + " items removed table @ index "+index);         }     } }); 

the listchangelistener.change documentation describes values returned c.getfrom(), c.getto(), c.wasremoved(), c.getadded(), etc. under various scenarios.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -