Reputation: 14144
The default behaviour for Dijit/Form/Select option is when you click it - it would close the options pane and assign the value to Select.
I would like options-pane to stay visible even when you click any of it. So the pane would disappear only if you would click outside of it.
How can I prevent options-pane from disappearing?
Upvotes: 0
Views: 121
Reputation: 5080
You can add an advice to the closeDropDown function.
aspect.around(myselect, 'closeDropDown', function(closeDropDown) {
return function(focus) {
if (focus == false) {
closeDropDown.apply(this, arguments);
}
}
})
See working example.
http://jsfiddle.net/RichAyotte/a85y8hnm/
Upvotes: 2
Reputation: 438
You can hook into the "change" event of Select widget then call it's openDropDown() function every time the value changes. Its not a 100% solution but it might get you to where you want.
Here is a jsfiddle with an example: http://jsfiddle.net/kagant15/3st69xbv/
var myselect = new Select({
name: "myselect",
options: [
{ label: "TN", value: "Tennessee" },
{ label: "VA", value: "Virginia", selected: true },
{ label: "WA", value: "Washington" },
{ label: "FL", value: "Florida" },
{ label: "CA", value: "California" }
]
}, "myselect");
myselect.on("change", function(){
this.openDropDown();
})
Upvotes: 1