Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comboboxes unexpectedly automatically closing when mouse is released

I've stumbled upon a phenomenon which I can't explain myself and I'm interested in why it is happening. I hope someone can explain me the reason and also how to get rid of this phenomenon:

I have created a few pages for the application and then a search page. So far so good. Whenever I tried to click on the combobox itself it opened normally, but as soon as I released the mousebutton it closed again. Except when I moved the mouse outside of the combobox area and THEN released it. The only thing out of the ordinary I saw there was that the focus was reset automatically to the last text-field before the combobox.

The combobox itself was a normal html combobox while the textbox itself was created with Html.TextBox("search") I also tried to change the namings in case I overlooked something in javascript but no changes.

I then tried the following:

 @Html.TextBox("search")


  Kategorie  @Html.DevExpress().ComboBox(
                    settings => {
                        settings.Name = "PrductCategory";
                        settings.ControlStyle.CssClass = "select";
                        settings.Width = 300;
                        settings.SelectedIndex = 0;
                        settings.Properties.DropDownStyle = DevExpress.Web.ASPxEditors.DropDownStyle.DropDown;
                        settings.Properties.IncrementalFilteringMode = DevExpress.Web.ASPxEditors.IncrementalFilteringMode.Contains;
                        settings.Properties.TextField = "Name";

                        settings.Properties.DisplayFormatInEditMode = false;
                        settings.Properties.Native = false;
                        settings.Properties.TextFormatString = "{0}";
                        settings.Properties.DisplayFormatString = "{0}";
                        settings.Properties.ValueField = "Id";
                        settings.Properties.ValueType = typeof(int);
                    }
  ).BindList(Categories).GetHtml()

This behaved as it should have the whole time (although the combobox was horribly formated. As I did not find out how to format it to look like a "normal html" combobox I decided to try the native mode but more to that below). When I set the native mode to true, the same phenomenon happened again (with false again it behaved normal). After a few hours of looking through tutorials and docs I'm still at a complete loss (especially as I didn't find any setfocus commands being used).

So my question is: Does anyone have any clue as to why that could happen and how to stop this phenomenon from happening?

Tnx

Remarks:

When in native mode and I switch via tab onto the combobox I can go through the list as normal (with the arrow keys), but I still can't open the combobox as it again closes automatically and the focus is reset onto the textbox ("search") as in all other cases (aside from native=false).

When native mode is set to false and I click on the combobox, then the focus is lost (and set to the text field before the combobox [and it's textfield] for under 1 second and then set to the combobox while the combobox does NOT close).

like image 867
Thomas Avatar asked Jan 10 '13 08:01

Thomas


1 Answers

Thomas,

It sounds like some of the DevExpress settings you're using to initialize the ComboBox may be causing strange behavior in the browser. Could you include a copy of what the rendered control looks like from the browser source?

It might be worth removing some of the optional settings such as IncrementalFilteringMode to see if that is causing a problem.

like image 136
Sean Kornish Avatar answered Sep 23 '22 07:09

Sean Kornish