#4870 closed defect (worksforme)
dijit.form.FilteringSelect, setValue & onChange
Reported by: | guest | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Dijit - Form | Version: | 1.0 |
Keywords: | FilteringSelect setValue onChange | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
Hello, I use the setValue function to select a default value in the FilteringSelect? dijit, but this function seems to not call the onChange function. Is this the correct behaviour ? Thx in advance. Kilroy
Attachments (2)
Change History (10)
comment:1 Changed 13 years ago by
Owner: | set to Douglas Hays |
---|
comment:2 Changed 13 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:3 Changed 13 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
The difference with the example is that I create my dijit programaticaly.
var w = dojo.byId('actionsAvalon'); if (w) { var dfltValue = w.value; w = new dijit.form.FilteringSelect ( { name : w.name , type : w.type , disabled : w.disabled , autocomplete : true , required : true , store : new dojo.data.ItemFileReadStore({ url: '/avalon/getActions' }) , onChange : function(action) {_this.onChangeAction(action); } , searchAttr : 'label' , invalidMessage: _this._strings['invalid_action'] , promptMessage : _this._strings['missing_action'] } , w ); w.setValue(dfltValue); /* [BUG] Ticket #4870: setValue don't call onChange */ _this.onChangeAction(dfltValue); }
Even If i set the value in the constructor.
Kilroy
comment:4 Changed 13 years ago by
Maybe there's a race condition if you call setValue() before the store has loaded the data? Try attaching the setValue() call to a button, or running after a delay, to see if that works.
Also, you can (and should) attach testcases using the "attach file" button.
BTW, you can replace {{ {function(action) {_this.onChangeAction(action); } }}} with dojo.hitch(_this, "_onChangeAction")
. It's just a little shorter to type.
comment:5 Changed 13 years ago by
Milestone: | 1.0 → 1.1 |
---|
comment:6 Changed 13 years ago by
I've changed :
w.setValue(dfltValue); /* [BUG] Ticket #4870: setValue n'appelle pas onChange */ _this.onChangeAction(dfltValue);
with :
setTimeout ( function(){dijit.byId('actionsAvalon').setValue(dfltValue);} , 15000 );
but setValue don't call onChange.
Kilroy
Changed 13 years ago by
Attachment: | test_FilteringSelect.html added |
---|
dijit/tests/form/test_FilteringSelect.html
comment:7 Changed 13 years ago by
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
I attached a programmatic example that works perfectly. Please try to recreate, starting with this example and tweak until it fails. Also, make sure you are using the latest trunk. I tested with [11354] with FF2 and IE6 on WinXP.
comment:8 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
This seems to work for me. Can you append a testcase? The nightly build has an example of a setDisplayedValue() that triggers onChange. http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/test_FilteringSelect.html The first select box has a button to set the value to Kentucky and you can see the input box to the right change to KY via onChange.
You can modify this test to call
setValue('KY')
instead of
setDisplayedValue('Kentucky')
to verify that this works as well.