Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#897 closed defect (invalid)

[PATCH]onchange event does not work on ComboBox

Reported by: vincent.demay@… Owned by: anonymous
Priority: high Milestone:
Component: Widgets Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

When a comboBox is created with Dojo, and when I want to add a listener on the onChanged event it does not work.

I made a patch that correct the bug, but it seems to be a little bit hacked. here is the patch :

For widget/templates/HtmlComboBox.html :


--- HtmlComboBox?.html 2006-01-16 00:35 :16.000000000 +0100 +++ HtmlComboBox?.html 2006-06-05 16:43:30.070746200 +0200 @@ -12,7 +12,7 @@

<tr valign="top">

<td width=100%>

<input type="text" class="comboBoxInput"

  • dojoAttachEvent="keyDown: onKeyDown; keyUp: onKeyUp;"

+ dojoAttachEvent="change: doChanged; keyDown: onKeyDown; keyUp: onKeyUp;"

dojoAttachPoint="textInputNode" style="width: 100%;">

</td>

For widget/html/ComboBox.js :


--- html/comboBox.js 2006-01-16 00:59:16.000000000 +0100 +++ html/comboBox.js 2006-06-05 17:24:24.631960700 +0200 @@ -35,6 +35,7 @@

this.searchTimer = null; this.searchDelay = 100; this.dataUrl = "";

+ this.onchange = "";

mode can also be "remote" for JSON-returning live search or "html" for dumber live search this.mode = "local";

@@ -279,6 +280,14 @@

if(this.bgIframe.iframe){

this.optionsListWrapper.appendChild(this.bgIframe.iframe);

}

+ + add on change listener + dojo.event.connect(this.comboBoxValue, "onClick", this, "doChanged"); + }, + + doChanged: function(){ + this.onchange = this.onchange.replace("this", "this.comboBoxValue"); + eval(this.onchange);

},

openResultList: function(results){

Attachments (2)

ComboBox.patch.txt (1.7 KB) - added by vincent.demay@… 13 years ago.
Here is the patch (easier readable ;) )
ComboBox.patch.2.txt (2.4 KB) - added by vincent.demay@… 13 years ago.
My new version

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by vincent.demay@…

Attachment: ComboBox.patch.txt added

Here is the patch (easier readable ;) )

comment:1 Changed 13 years ago by bill

Milestone: 0.3.1
Resolution: invalid
Status: newclosed

You can attach to setValue() in order to monitor the changes to combobox. See the files in the tests/widget directory for examples. Does that solve the problem?

comment:2 Changed 13 years ago by vincent.demay@…

Ok, I solve my problem with running onchange function when the combo is empty (in setValue) and when an item is selected (in selectOption) and everything works properly I also add a parameter to set the widget width (I join the patch if you want)

Thanks for your help

Changed 13 years ago by vincent.demay@…

Attachment: ComboBox.patch.2.txt added

My new version

comment:3 Changed 12 years ago by (none)

Milestone: 0.3.1

Milestone 0.3.1 deleted

Note: See TracTickets for help on using tickets.