Skip to content

Commit

Permalink
Make JTable sortable in edit inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudFofou committed Nov 22, 2024
1 parent d901d81 commit 3120a83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/isf/medicalinventory/gui/InventoryEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;

import org.isf.generaldata.GeneralData;
import org.isf.generaldata.MessageBundle;
Expand All @@ -91,7 +93,6 @@
import org.isf.menu.manager.Context;
import org.isf.menu.manager.UserBrowsingManager;
import org.isf.stat.gui.report.GenericReportPharmaceuticalInventory;
import org.isf.stat.manager.JasperReportsManager;
import org.isf.supplier.manager.SupplierBrowserManager;
import org.isf.supplier.model.Supplier;
import org.isf.utils.db.NormalizeString;
Expand Down Expand Up @@ -229,7 +230,6 @@ private void fireInventoryUpdated() {
private MedicalDsrStockMovementTypeBrowserManager movTypeManager = Context.getApplicationContext().getBean(MedicalDsrStockMovementTypeBrowserManager.class);
private SupplierBrowserManager supplierManager = Context.getApplicationContext().getBean(SupplierBrowserManager.class);
private WardBrowserManager wardManager = Context.getApplicationContext().getBean(WardBrowserManager.class);
private JasperReportsManager jasperReportsManager = Context.getApplicationContext().getBean(JasperReportsManager.class);

public InventoryEdit() {
mode = "new";
Expand Down Expand Up @@ -1127,6 +1127,8 @@ public void valueChanged(ListSelectionEvent e) {
});
DefaultCellEditor cellEditor = new DefaultCellEditor(jTextFieldEditor);
jTableInventoryRow.setDefaultEditor(Integer.class, cellEditor);
TableRowSorter<TableModel> sorter = new TableRowSorter<>(model);
jTableInventoryRow.setRowSorter(sorter);
}
return jTableInventoryRow;
}
Expand Down

0 comments on commit 3120a83

Please sign in to comment.