header is not showing "checkable"
Added by Mark Travis over 1 year ago
I've got the following line to set my WStandardItemModel header to "checkable"
result->setHeaderFlags(matrixColumn, Wt::Orientation::Horizontal, Wt::HeaderFlag::UserCheckable | Wt::HeaderFlag::XHTMLText);
But there is no checkbox on the header. I checked the value of the headerflag_ in the debugger, and it's 72, which is the sum of 64 + 8 (or 0x40 + 0x8).
I tried Tristate as well, but nothing shows up to allow me to check or uncheck anything in the header.
Replies (3)
RE: header is not showing "checkable" - Added by Mark Travis over 1 year ago
Let me ask another way.
What behavior should I expect to see if I do the following on a plain, vanilla WTableView using a WStandardItemModel.
WTableView* tableView = new WTableView();
WStandardItemModel* standardModel = new WStandardItemModel();
... assign some data to standardModel including setting header data....
standardModel->setHeaderFlags(columnNumber, Wt::Orientation::Horizontal, Wt::HeaderFlag::UserCheckable);
What does Wt::HeaderFlag::UserCheckable do in this instance?
I assume I don't have to write an ItemDelegate for it since it's already implemented as an existing ItemDataRole. Correct?
RE: header is not showing "checkable" - Added by Roel Standaert over 1 year ago
UserCheckable
allows the user to interact with the checked state. However, you should still set the initial state:
standardModel->setHeaderData(columnNumber, Wt::Orientation::Horizontal, false, Wt::ItemDataRole::Checked);
RE: header is not showing "checkable" - Added by Mark Travis over 1 year ago
Yes! That worked. Thank you!