I have a TreeTableView, where Model is defined as:
class Model {
private final Integer _id;
private final String _name;
private final Integer _count;
public Model(int id, String name, int count) {
_id = id;
name = _name;
count = _count;
}
public Integer getId() { return _id; }
public String getName() { return _name; }
public Integer getCount() { return _count; }
}
In the TreeTableView, I group the rows by name, and put nulls in the fields of the header if the corresponding field of its children are not the same. Here is an example to make it clear:
td {
width: 50px;
text-align: center;
}
<table border="1">
<tr>
<td>▼</td><td>-</td><td>Apple</td><td>-</td>
</tr>
<tr>
<td></td><td>100</td><td>Apple</td><td>7</td>
</tr>
<tr>
<td></td><td>101</td><td>Apple</td><td>2</td>
</tr>
<tr>
<td></td><td>105</td><td>Apple</td><td>3</td>
</tr>
<tr>
<td>▼</td><td>-</td><td>Apple</td><td>2</td>
</tr>
<tr>
<td></td><td>151</td><td>Apple</td><td>2</td>
</tr>
<tr>
<td></td><td>160</td><td>Apple</td><td>2</td>
</tr>
<tr>
<td></td><td>163</td><td>Apple</td><td>2</td>
</tr>
</table>
In the first expanded row, the 3rd column is "-" (because its children have different values for that column), whereas the second expanded row has "2" for its 3rd column because its children have the same value for that column.
The "-" is represented as null in the Model class (that's why it has Integer and not int).
Here is the problem: When sorting the 3rd column in ascending order, the first row remains first, because it contains null which is considered less than the value 2 of the second expanded row...
What I want is to be able to manually select the minimum and maximum values for parent nodes, so I can select the minimum and maximum of its children. TreeTableColumn has a set comparator method, but that one compares Models, not TreeItem.