Search code examples
javafx-8controlsfx

How to divide cells instead of spanning the multiple cells in SpreadSheetView?


I would like to divide 1 cell into multiple cells instead of using the row and column spans. Because I want to be able to change the cell content dynamically after I use setGrid() method.

Even though I use SpreadsheetCellType.LIST to create cell, it just shows the first value of the list and it does not seperate cells. I could not find any information in the document ; https://controlsfx.bitbucket.io/org/controlsfx/control/spreadsheet/SpreadsheetCellType.ListType.html.

What I want is someting like this (3rd row , 1st column): Multiple Cell Example

Is this possible ?


Solution

  • I found a way, with different approach . Instead of creating 2 cells , I created ListView for each cell and set as graphic .

    SpreadsheetCell cell = SpreadsheetCellType.STRING.createCell(x, y, 1, 1, "");
    ListView<SpreadListCell> listView = new ListView<>(valuesList);
    listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    listView.setPrefHeight(valuesList.size()*24);
    cell.setGraphic(listView);