0
我有兩個基於相同數據存儲的Select dijits。第一個dijit是必需的響應,第二個dijit是可選的響應。對於第二個dijit,我想將其他項目「無」添加到列表頂部。但是,當我這樣做時,我無法選擇列表中的第二項。在此JSBin中,如果您在第二個dijit中選擇「常規湖底貼圖」,則返回的值是添加的項目「無」。將一個項目添加到Dojo頂部選擇dijit,但無法選擇第二個項目
require(["dijit/form/Select",
"dojo/data/ObjectStore",
"dojo/store/Memory",
"dojo/domReady!"
], function (Select, ObjectStore, Memory) {
var data = [
{ id: 0, label: 'General lakebed mapping' },
{ id: 1, label: 'Bathymetry/Digital Elevation Model' },
{ id: 2, label: 'Ferrous object detections/magnetic anomalies' },
{ id: 3, label: 'Ground-truth data' },
{ id: 4, label: 'Lakebed color' },
{ id: 5, label: 'Lakebed surface type, hardness/smoothness/slope' },
{ id: 6, label: 'Sub-bottom geology' }
];
var store = new Memory({
data: data
});
var os = new ObjectStore({ objectStore: store });
var s = new Select({
store: os,
sortByLabel: false
}, "target");
s.startup();
data.unshift({ id: -1, label: 'None' })
store.setData(data);
var s1 = new Select({
store: os,
sortByLabel: false
}, "target1");
s1.startup();
s1.on("change", function() {
console.log("my value: ", this.get("value"))
});
})
無法在提供的JSBin鏈接中看到任何內容。沒有代碼。 – Himanshu