coding Bott
coding Bott

Reputation: 4357

Looking for a Dijit Widget which works like a default html select

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?

Upvotes: 0

Views: 1841

Answers (3)

Bennett McElwee
Bennett McElwee

Reputation: 25740

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.

Upvotes: 0

Michael B
Michael B

Reputation: 106

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

Upvotes: 0

seth
seth

Reputation: 37267

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.

Upvotes: 1

Related Questions