سؤال

MyTableModel extends DefaultTableModel, everything looks and works correctly.

I have one editable column, and the setValueAt() is being called, and the database updated.

However the table itself is not being refreshed ?

I override, getColumName(), getRowCount(), isCellEditable(), getColumClass(), and setValueAt() - which gets called, and fires the database update. The model is backed by a list, which is updated in setValueAt().

And the model is set simply by myTable.setModel(myTableModel);

هل كانت مفيدة؟

المحلول

Do you call super.setValueAt() in your code?

Looks like your changes skips events firing.

نصائح أخرى

Call fireTableCellUpdated() at the end of setValueAt() method. It must help you.

Maybe you need to refresh the cache of the TableModel. In order to do it you can override fireTableDataChanged() and call the super method at the end of the overriding.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top