[Dojo-interest] ComboBox problems

mano dasanayake mano at mubasher.net
Wed Apr 4 06:22:08 UTC 2007


Hi, 

 We encountered some thing similar to this, when there are no matching found
in the result list, dojo comboBox looses its focus.

There is a quick fix,

Try commenting out 

1) if(!results.length){

                        //this._hideResultList(); // do not hide the
popupwidget..

                  }

 

Within the function "_openResultList".

 

2)

 

 _showResultList: function(){

                  // Our dear friend IE doesnt take max-height so we need to
calculate that on our own every time

                  var childs = this.optionsListNode.childNodes;

                  if(childs.length){

                        dojo.html.removeClass(this.textInputNode,
"dojoComboBoxItemInvalid", true);      //Chamara

                        var visibleCount =
Math.min(childs.length,this.maxListLength);

 

                        with(this.optionsListNode.style)

                        {

                              display = "";

                              if(visibleCount == childs.length){

                                    //no scrollbar is required, so unset
height to let browser calcuate it,

                                    //as in css, overflow is already set to
auto

                                    height = "";

                              }else{

                                    //show it first to get the correct
dojo.style.getOuterHeight(childs[0])

                                    //FIXME: shall we cache the height of
the item?

                                    height = visibleCount *
dojo.html.getMarginBox(childs[0]).height +"px";

                              }

                              width =
(dojo.html.getMarginBox(this.domNode).width-2)+"px";

                        }

                        this.popupWidget.open(this.domNode, this,
this.downArrowNode);

                  }else{

                        //this._hideResultList();  // don't hide the
popupwidget,.

                        

                                          }

            },

 

 

 3) within the "_handleKeyEvents" function,

 

            case k.KEY_BACKSPACE:

                              this._prev_key_backspace = true;

                              if(!this.textInputNode.value.length){

                                    this.setAllValues("", "");

                                    //this._hideResultList();     //Chamara

                                    doSearch = false;

                              }

                              break;

 

 

Seems like it looses the focus as we call hideResultset()..

 

Best regards,

Mano

 

  _____  

From: dojo-interest-bounces at dojotoolkit.org
[mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Harry Ng
Sent: Wednesday, April 04, 2007 9:40 AM
To: dojo-interest at dojotoolkit.org
Subject: [Dojo-interest] ComboBox problems

 

Hi all,

I am making use of ComboBox from version 0.4.1 in my project, and I found a
few problems. Do you have any suggestion on the solution or workarounds?
Please feel free to let me know.

1. Setting Default Value of ComboBox 

I can successfully set the default value using a few methods, including (a)
setValue(), (b) setAllValues(), (c) targetWidget.textInputNode.value.
However, I found that either way will not trigger the onValueChanged event. 
Platform: IE6, IE7, FF2.0.0.3

2. Losing Focus using Backspace

In using the ComboBox with IE, I got this problem. I type in the ComboBox,
and I press Backspace until the cursor goes to start place, and one
Backspace more, the dropdown disappears, then the focus on ComboBox loses.
If I press one more Backspace, it will treat it as usual event to the
browser and goes to previous browser page. This case also happens in the
nightly build. 
Platform: IE6, IE7

3. Losing Focus for non-existing value

This case is for IE also, and happens for both autocomplete on and off.
Firstly, I type some characters that exists, then type some characters not
exists. As no matches found, the dropdown disappears, and the ComboBox loses
focus. Then press Backspace will just goes back to previous browser page.
Also, this happens in nightly build as well. 
Platform: IE6, IE7

I read a page before which someone changes the logic of ComboBox, so that it
works well on IE. The reference is here:
http://home.exetel.com.au/cweatures/combosample/combotest.html

Is there any plan on enhancing ComboBox?

Thanks for your kind attention.

Regards,
Harry

-- 
My Weblog - http://wpmu.planner4u.org/
LinkedIn - http://www.linkedin.com/in/harryng 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070404/e5108b71/attachment-0001.html


More information about the Dojo-interest mailing list