#11284 closed enhancement (fixed)
[patch] [cla] dojox.form.manager._Mixin to pass !this.watch as priorityChange when setting values
Reported by: | ben hockey | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | DojoX Form | Version: | 1.5.0b2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
dijit.form._FormValueWidget
allows passing an extra optional parameter (priorityChange
) when setting form widget values which will prevent onChange
from firing.
_setValueAttr: function(/*anything*/ newValue, /*Boolean, optional*/ priorityChange){ // summary: // Hook so attr('value', value) works. // description: // Sets the value of the widget. // If the value has changed, then fire onChange event, unless priorityChange // is specified as null (or false?) this.value = newValue; this._handleOnChange(newValue, priorityChange); },
since the onChange
is now fired via a setTimeout
, the priorityChange
parameter is really the most effective way to prevent/ignore onChange
.
without the setTimeout
it was possible to have the observer ignore the onChange
by setting this.watch = false;
then in the next line of code set widget values in the form via the form manager and then set this.watch = true;
again. however, with the setTimeout
firing the onChange
now, it has become difficult to prevent/ignore onChange
.
i considered 2 ways that the form manager could pass in the priorityChange
parameter.
- change
formWidgetValue
(and other functions which call it) to take a priorityChange parameter that is passed along to the widget's setter when setting values of widgets. - pass in
!this.watch
as thepriorityChange
parameter when setting form widget values.
i like the 2nd option since it doesn't change any function signatures and uses the value of this.watch
to (indirectly) prevent the observer from being fired. i will attach a patch for this option but would be interested in discussing other options.
Attachments (1)
Change History (4)
Changed 11 years ago by
Attachment: | 11284.patch added |
---|
comment:1 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|---|
Status: | new → assigned |
comment:2 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 Changed 9 years ago by
This change is causing the failure in #14985. "this.watch" (changed later to this.watching) is undefined inside the anonymous functions.
use !this.watch as priorityChange