I use RowSorter in JTable, and when I sort one of the columns and call the getSelectedRowData () method, it returns incorrect data.
public Object getSelectedRowData()
{
if(getDataArray() != null)
{
if(grid.getRowSorter() != null)
return ((GridModel) grid.getRowSorter().getModel()).getData().get(grid.getSelectedRow());
else
return model.getData().get(grid.getSelectedRow());
}
else
return null;
}
I think the problem is that the sorter sorts the table data, but the ArrayList with the data does not reload. How can i fix this?
source
share