class org.aswing.table.sorter.TableSorter extends AbstractTableModel
Interfaces | |||
![]() | TableModelListener |
|
A class that make your JTable sortable. Usage:
var sorter:TableSorter = new TableSorter(yourTableModel); sorter.setTableHeader(yourTable.getTableHeader()); yourTable.setModel(sorter);
Class Fields
Instance Fields
![]() | Show inherited public instance fields | Hide inherited public instance fields
|
function new(?tableModel:TableModel = null, ?tableHeader:JTableHeader = null): Void
TableSorter(tableModel:TableModel, tableHeader:JTableHeader)
TableSorter(tableModel:TableModel)
TableSorter()
function getComparator(column:Int): Dynamic ->Dynamic ->Int
Returns the comparator function for given column.
returns | the comparator function for given column. |
See Also
- this.setColumnComparator()
function isColumnSortable(column:Int): Bool
Returns specified column sortable, default is true.
returns | true if the column is sortable, false otherwish |
function modelIndex(viewIndex:Int): Int
Calculates the model index from the sorted index.
returns | the index in model from the sorter model index |
function setColumnComparator(columnClass:String, comparator:Dynamic ->Dynamic ->Int): Void
Sets a comparator the specified columnClass. For example:
setColumnComparator("Number", aNumberComparFunction);
columnClass | the column class name |
comparator | the comparator function should be this spec: function(o1, o2):int, it should return -1 or 0 or 1. |
See Also
- org.aswing.table.TableModel.getColumnClass()
function setColumnSortable(column:Int, sortable:Bool): Void
Sets specified column sortable, default is true.
column | column |
sortable | true to set the column sortable, false to not |
function setSortingStatus(column:Int, status:Int): Void
Sets specified column to be sort as specified direction.
column | the column to be sort |
status | sort direction, should be one of these values:
|
function setTableHeader(tableHeader:JTableHeader): Void
Sets the table header
tableHeader | the table header |