데이터 소스를 json 형식으로 데이터 스토어로 선택하려고하지만 데이터 소스의 텍스트가 아닌 드롭 다운에 상자 만 나타납니다. 데이터 저장소는 데이터베이스에서 가져온 및 형식에 있습니다 :json 데이터 스토어로 설정할 때 데이터 소스가 나타나지 않습니다.
{
"GetReachesResult":[
{
"reach":"CRC"
},
{
"reach":"IV"
},
{
"reach":"IVA"
},
{
"reach":"IVB"
},
{
"reach":"IVD"
},
{
"reach":"IVE"
},
{
"reach":"V"
}
]
}
드롭 다운의 저장소를 설정하려고 코드의 모듈은 다음과 같습니다
define(['dojo/store/Memory', 'dojo/_base/xhr', "dojo/data/ObjectStore"],
//functions to get data and fill data stores
function (Memory, xhr, ObjectStore) {
return {
GetReaches: function (url) {
xhr.get({//get data from database
url: url,
//url: url,
handleAs: "json",
load: function (result) {
var ReachData = result.GetReachesResult; //GetReachesResult is default reach of GetReaches Method
var ReachStore = new Memory({ data: ReachData });
var oReachStore = new ObjectStore({ objectStore: ReachStore });
DD.setStore(oReachStore);
},
error: function (err) { }
});
} //GetReaches
}
});
메인 페이지에서 호출 모듈은 다음과 같습니다.
....
DD = new Select({
style: { width: '250px' }
}, "DropDownDiv");
DD.startup();
var myButton = new Button({
label: "Get Data",
onClick: function() {
Data.GetReaches(dataServiceUrl);
}
}, "ButtonDiv");
});
아이디어가 있습니까? 감사합니다