Actions
Feature #1179
closed<option disabled="disabled">
Start date:
03/07/2012
Due date:
% Done:
0%
Estimated time:
Description
Hi,
I am missing some WComboBox method for disabling options in according to http://www.w3schools.com/tags/att_option_disabled.asp .
Here is a js way for manipulating "disabled" attribute
o.options[i].disabled = "disabled"; /* disable i-th option of select o */
o.options[i].disabled = ""; /* enable i-th option of select o */
"Disabled" attribute is not working in IE prior IE8, but there are some workarounds.
regards,
Jan
Updated by Jan Hrubeš almost 13 years ago
I wrote a little function for this.
void enableOption(WComboBox* cb, int i, bool enabled)
{
if ( (i>=0) && (i<cb->count()) )
{
std::string d = enabled ? "\"\"" : "\"disabled\"";
std::stringstream ss;
ss << cb->jsRef() << ".options[" << i << "].disabled=" << d << ";";
WApplication::instance()->doJavaScript(ss.str());
}
}
Updated by Koen Deforche over 11 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.3.1
Updated by Koen Deforche over 11 years ago
- Status changed from InProgress to Resolved
The combo-box will interpret the ItemIsSelectable flag of the model to disable an item accordingly. We've also updated the WStringListModel to be able to set these flags.
Updated by Koen Deforche over 11 years ago
- Status changed from Resolved to Closed
Actions