Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a dynamic table with checked box.I want to disable an entire column(for example: in attendence marking system the Sunday column should be un markable).I know generally we will use use this code to disable a column.

columnName.setEditable(false)
So How i can apply this method on dynamic table and Here is my code


What I have tried:

private static final List<String> groups = Arrays.asList("Sunday", "Monday", "Tuesday", "Wednesday","Thursday","Friday");
 TableView<AttributeRow> attributeTable = new TableView<>();
 for (String group : groups) { //creating dynamic column
        TableColumn<AttributeRow, Boolean> groupColumn = new TableColumn<>(group);
        groupColumn.setCellFactory(CheckBoxTableCell.forTableColumn(groupColumn));
        groupColumn.setCellValueFactory(cellData -> cellData.getValue().activeProperty(group));
        attributeTable.getColumns().add(groupColumn);
    }
Any help will be appreciated
Posted
Comments
Richard MacCutchan 2-Jan-17 4:42am    
Just do it when you create the column for Sunday in your loop.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900