Opened 12 years ago

Closed 12 years ago

Last modified 9 years ago

#4937 closed defect (fixed)

Initial empty state in Filtering Select doesn't fire onChange

Reported by: Adam Peller Owned by: haysmark
Priority: high Milestone: 1.0
Component: Dijit - Form Version: 0.9
Keywords: Cc: Douglas Hays
Blocked By: Blocking:

Description (last modified by Adam Peller)

I'm changing the test case to reflect this bug.

In FilteringSelect #2, it no longer defaults to IA. The FilteringSelect is empty. Now select a value. The first time onChange does not fire and the widget next to it is not updated. Select another value and the update happens.

Change History (12)

comment:1 Changed 12 years ago by Adam Peller

Description: modified (diff)

comment:2 Changed 12 years ago by Adam Peller

Description: modified (diff)

comment:3 Changed 12 years ago by Adam Peller

(In [11206]) Test case for FilteringSelect? onChange bug. Refs #4937

comment:4 Changed 12 years ago by Adam Peller

should labelFunc be spelled out and/or private?

comment:5 Changed 12 years ago by Adam Peller

Description: modified (diff)

comment:6 Changed 12 years ago by Douglas Hays

Cc: Douglas Hays added; haysmark removed
Owner: changed from Douglas Hays to haysmark

comment:7 Changed 12 years ago by bill

See also duplicate #4941 in case that's clearer.

comment:8 Changed 12 years ago by haysmark

Guys, isn't this behavior of not calling onChange by design in _FormWidget, thus applying to all widgets?

You tell me:

	setValue: function(/*anything*/ newValue, /*Boolean, optional*/ priorityChange){
		// summary: set the value of the widget.
		this._lastValue = newValue;
		dijit.setWaiState(this.focusNode || this.domNode, "valuenow", this.forWaiValuenow());
		if(this._lastValueReported == undefined){ // don't report the initial value
			this._lastValueReported = newValue;
		}
		if((this.intermediateChanges || priorityChange) && newValue !== this._lastValueReported){
			this._lastValueReported = newValue;
			this.onChange(newValue);
		}
	},

comment:9 Changed 12 years ago by haysmark

I claim undefined==null==""==0==whatever

comment:10 Changed 12 years ago by Adam Peller

seems to be, though I can't imagine what the usecase is for that. I can imagine the use case for getting notifications on every change.

Yeah, use of == undefined is not precise and should be made more explicit.

comment:11 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [11247]) Fixes #4937. The filteringselect initial setvalue was failing since "" was not a valid value and thus it refused to call setvalue. Thus the user selected value became the first value and was thus ignored by _formwidget. This is especially confusing since the filteringselect setvalue is asynchronous, so _formwidget doesn't know how long to wait for the initial setvalue. To avoid this parallox, I defined the priorityChange boolean of setValue to be null during postCreate, so _formwidget can detect if a setvalue should be ignored or not.

comment:12 Changed 9 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.