views:

921

answers:

3

Hi,

I'm looking for a dijit widget which works like a normal html select (combobox). all dijit widgets i found until now, have an editable text box. I prefer to have a drop down box only and no editable textbox.

<select name="aCombobox">
    <option value="1" selected="selected">Hund</option>
    <option value="2">Katze</option>
    <option value="3">Maus</option>
    <option value="4">Waldelfe</option>
</select>

Also important for me is, that the upper code is working with the widget and the widget have to use the "Value" values and not the display text.

I checked this dijit widgets: combobutton, combobox, filteringselect, dropdownbutton.

Maybe there is an attribute i forgot to set.

Is there a widget which meet my requirements?

+1  A: 

I think you need to use dijit.form.FilteringSelect:

 <select name="aCombobox" dojotype="dijit.form.FilteringSelect">
     <option value="1" selected="selected">Hund</option>
     <option value="2">Katze</option>
     <option value="3">Maus</option>
     <option value="4">Waldelfe</option>
     <script type="dojo/connect" event="onChange">
       console.log( 'picked ' + this.attr('value') + 
                    ' = ' + this.attr('displayedValue') );
     </script>
 </select>

Hope this helps.

If you are feeling adventurous, you can try out dijit.form.DropDownSelect. It just got added on 7/21 to trunk. Here's the test.

seth
i tried that, it has also a editable edit. maybe I'm wrong - i will try it again on Monday.
Bernd Ott
What do you mean by 'editable edit'? Do you mean a textinput?
seth
in front of the drop down button is a editbox. i don't want that somebody can enter text there. that "select" have to work in the default windows way without any extension like filtering or selecting by typing.
Bernd Ott
Ah, gotcha. Why not just use a plain vanilla select then. Seems like you don't need a dijit for this.
seth
i'm using dijit because our webdesigner can put his own design on it. on plain html he cant. the inputs depending to much on browser and OS.
Bernd Ott
Ok, updated my answer. Otherwise, I think you'll need to create your own sublcass.
seth
Thank you, allot.
Bernd Ott
You are welcome.
seth
A: 

I'm new so can't leave comments yet, but seth mentions dijit.form.DropDownSelect being in trunk - this is for 1.4 I believe; 1.3 has it in dojox as dojox.form.DropDownSelect

Michael B
seth has already said that.see his link "Here's the test."
Bernd Ott
@Bernd - thanks, but I was specifically pointing out that in 1.3 it is in dojox, not dijit.
Michael B
A: 

dijit.form.Select is what you need. It's in the latest builds and will be in 1.4. You can currently download it as part of the development release. The test page has a bunch of demos.

It looks as if this replaces the dijit.form.DropDownSelect that seth mentioned.

We had the same problem about 6 months ago. We ended up using FilteringSelects, which was ugly. Nice to see that the Dojo people have finally made a proper select list.

Bennett McElwee