Project

General

Profile

Actions

Feature #1179

closed

<option disabled="disabled">

Added by Jan Hrubeš about 12 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
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

Actions #1

Updated by Jan Hrubeš about 12 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());
        }
}
Actions #2

Updated by Koen Deforche almost 11 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
  • Target version set to 3.3.1
Actions #3

Updated by Koen Deforche over 10 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.

Actions #4

Updated by Koen Deforche over 10 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF