Opened 8 years ago

Closed 8 years ago

#14753 closed defect (fixed)

Inconsistent behaviour when settings options on a dijit.form.Select

Reported by: Simon Dahlberg Owned by: Douglas Hays
Priority: undecided Milestone: 1.8
Component: Dijit - Form Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:

Description

setting options with select.set("options") only work the first time. When options is set later, items in the dropdown list is not updated.

OS: Mac OSX 10.7 Firefox 10.0, Chrome 16.0.912.77

A jsFiddle to demonstrate the code below

require([
    "dojo/ready",
    "dijit/form/Select",
    "dijit/form/Button",
    "dojo/_base/connect",
], function(ready, Select, Button, connect) {
    var l1 = [
        { label: "opt1", value: "1"},
        { label: "opt2", value: "2"},
        { label: "opt3", value: "3"}
    ];
    var l2 = [
        { label: "opt4", value: "4"},
        { label: "opt5", value: "5"},
        { label: "opt6", value: "6"}
    ];
    ready(function() {
        var select = new Select({
        }, "select");
        
        var btnL1 = new Button({}, "btnL1");
        var btnL2 = new Button({}, "btnL2");
        var btnRun = new Button({}, "btnRun");
        
        connect.connect(btnL1, "onClick", function(e) {
            console.log("set options to l1");
            select.set("options", l1);
            select.reset();
        });
        
        connect.connect(btnL2, "onClick", function(e) {
            console.log("set options to l2");
            select.set("options", l2);
            select.reset();
        });
        
        select.startup();
        btnL1.startup();
        btnL2.startup();
        btnRun.startup();
    });
});

Change History (2)

comment:1 Changed 8 years ago by Douglas Hays

Milestone: tbd1.8
Status: newassigned

comment:2 Changed 8 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

In [28011]:

Fixes #14753. Clear _isLoaded when options are changed to cause a reload.

Note: See TracTickets for help on using tickets.