Support #3519
openHow to add Wcheckbox on Table header row
0%
Description
We want to display checkbox in a Table header column as its item instead of String. I tried using WStandardItem as WCheckbox. But it still renders them as String/Object.
Requirement is to select all the checkboxes with in a column on a table when user selects checkbox on a header row.
For reference attached image file with highlighted by orange colour.
We are using model.setHeaderData(index, Orientation.Horizontal, value) line of code to Set header data for a column.
Please assist to add checkbox on header row and how to get action listener if user selected/unselected checkbox.
Files
Updated by Wim Dumon over 9 years ago
- Status changed from New to Resolved
My apologies for the pseudo-code. To check/uncheck the checkbox in the header:
model.setHeaderData(index, Orientation.Horizontal, value, CheckStateRole);
To show/hide the checkbox in the header:
model.setHeaderFlags(index, Orientation.Horizontal, HeaderIsUserCheckable);
To react when changed, reimplement setHeaderData and do what needs to be done when the CheckStateRole data of the first column is changed.
Best regards,
Wim.