TableView Cell Span


Is there any way to make a TableCell span horizontally? I want to create a tableview in JavaFX 2.2 similar to the one showed in the attached image


By the way, the image came from a sample of this funcionality but it is specific for Java FX 8.0. I've been trying to use a rowFactory but there isn't enough documentation on how to use it.

Thanks in advance.

6/4/2013 8:58:18 PM

Accepted Answer

Cell spanning in the JavaFX platform was implemented for Java 8, then cut as part of feature trim.
It may go into a future release.

The feature request to track for cell spanning is RT-24747 Cell spanning / merging in TableView. (Which is just the feature request that provided the image referenced in your question).

The linked feature request includes sample code for showing a table with row and column spanning for cells. The sample code relies on a patch attached to the feature request. The patch modifies JavaFX controls code for Java 8.

You can study the code and patch in the feature request to determine if you can implement such technology for yourself in user code without patching the JavaFX runtime.

The only code I know which customizes the row factory is the code in openjfx for the default TableView row handling - and that's not straightforward. For reference, the code is in, and

An alternative to implementing your own row factory is Updating TableView row appearance, that uses css to modify the style of certain cells or an entire row rather than making use of a completely custom row factory. Rather than implementing an entirely new row factory, you may be able to get the effect you want by modifying css styles to remove line separators between spanned cells .

Use of the ScenicView or the SceneBuilder CSS Analyzer tools may assist in determining the required css styles to be modified.

5/23/2017 12:34:11 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow