JavaFX: TableView: Arrow for a column sorted by default

后端 未结 1 1043
悲&欢浪女
悲&欢浪女 2020-12-31 09:30

I have a simple java fx application which has a table view. The table view shows some data that is sorted in a certain order. Is there a way to show the arrow(by default) in

相关标签:
1条回答
  • 2020-12-31 10:02

    Try

    ...
    firstNameCol.setSortType(TableColumn.SortType.ASCENDING);
    ...
    tableView.setItems(data);
    tableView.getColumns().addAll(firstNameCol, lastNameCol, emailCol, ageCol);
    tableView.getSortOrder().add(firstNameCol);
    ...
    

    Also see the discussions on: Javafx: Re-sorting a column in a TableView.

    0 讨论(0)
提交回复
热议问题