Martin Fehrs
Martin Fehrs

Reputation: 1091

dijit selection list with single selection

maybe I'm blind, but I wasn't able to find a selection-list widget which only allows a single selection.

There are dijit.form.Select and dijit.form.MultiSelect

Which is nearly what I want. But he first one is a drop down list and The scond one allows multiple selections. What I need is amixture of both. It should look like a MultiSelect and behave like a Select.

Is there Such a thing?

Kind regards,

Martin Kalbfuß

Upvotes: 2

Views: 416

Answers (1)

Richard
Richard

Reputation: 1138

If you're using dojo before 1.9, then you can do something like this:

var multiSelect = new MultiSelect({
   multiple: false,
   size: 3
});

Or the non-programmatic (declarative) way:

<select data-dojo-type="dijit/form/MultiSelect" data-dojo-props="multiple: false, size: 3">
   <option value="1">1</option>
   <option value="2">2</option>
</select>

For some reason, the behavior has changed somewhere around dojo 1.9. I haven't looked into anything regarding this past dojo 1.9, but if you're using an older dojo version, then this will work.

Upvotes: 1

Related Questions