Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable a "dijit.form.FilteringSelect" widget?

I cannot find a way to disable the dijit.form.FilteringSelect widget. The requirement makes the css display as none is not an option.

Any hint? Thanks in advance.

like image 264
Dreamer Avatar asked Aug 10 '12 20:08

Dreamer


1 Answers

Figure it out myself:

dijit.byId('_fromState_id').set('disabled', true);

simply does the job. Change it to false can enable the widget.

Cheers.

UPDATE

Plus, there is another attribute to the widget called "readOnly", the difference from it and "disabled" is that :

  1. disabled does not allow any value given to the widget, meaning the widget value is always NULL("") in the form. It might be a problem in NotNull situation;

  2. but readOnly allows to preset a value to the widget and make it not editable, and user can still submit the value just only not able to change it.

sample:

  dijit.byId("_fromState_id").set("value", "NOTAVAILABLE");
  dijit.byId('_fromState_id').set('readOnly', true);
like image 144
Dreamer Avatar answered Oct 22 '22 19:10

Dreamer