Trying to figure out on how can i disable the reordering of table columns in javafx 2?
How to disable the reordering of table columns in tableView?
Here's the solution:
tblView.getColumns().addListener(new ListChangeListener() {
@Override
public void onChanged(Change change) {
change.next();
if(change.wasReplaced()) {
tblView.getColumns().clear();
tblView.getColumns().addAll(column1,column2...);
}
}
});
@Audiphone So, it's been 1 year, any sign of an improved API method to lock the columns ? –
Hesperus
Feature request RT-26283 "Support "locking" columns (and rows) in TableView" was created. There has been no progress made on it and the request is currently not scheduled. The feature request was accepted, so a patch request to openjfx to add the feature would probably be accepted. –
Audiphone
thats not a solution to just delete every column and add them again. –
Noh
After much waste of time, I've found the following, very simple, solution:
TableHeaderRow header = (TableHeaderRow) myTableView.lookup("TableHeaderRow");
header.setMouseTransparent(true);
Like a charm in Java 8. –
Lani
© 2022 - 2024 — McMap. All rights reserved.
TableView
class, you might want to also log a feature request against the JavaFX runtime project. – Audiphone