dojo에서 동적 격자를 만들려고합니다. 기본적으로 선택 양식과 격자가 있고 선택 옵션을 선택하면 그리드에 다른 데이터 세트를로드해야합니다.dojo에서 select가있는 격자
코드 :
contentPane = new ContentPane({
title: "Group 1",
});
//Create grid
function genGrid(dataframe){
alert(dataframe);
myStore = Cache(JsonRest({target:"/data/"+dataframe}), Memory());
return grid = new DataGrid({
store: dataStore = ObjectStore({objectStore: myStore}),
structure:[{"field": "division", "name": "division", "width": "200px"}, {"field": "country", "name": "country", "width": "200px"}, {"field": "sales", "name": "sales", "width": "200px"}, {"field": "cost", "name": "cost", "width": "200px"}]},
"target-node-id").placeAt(contentPane.containerNode);};
sel = new Select({
name: 'select2',
onChange: function(select){alert(select);
genGrid(select)},
options: [
{ label: 'TN', value: 'Tennessee' },
{ label: 'VA', value: 'Virginia', selected: true },
{ label: 'WA', value: 'Washington' },
{ label: 'FL', value: 'Florida' },
{ label: 'CA', value: 'csvtable' }]
}).placeAt(contentPane.containerNode);
contentTabs.addChild(contentPane);
그러나,이 코드는 작동하지 않습니다. sel onChange 특성 외부에서 genGrid (dataframe)를 호출하면 모눈이 나타나지만 select에서 옵션을 선택하면 변경되지 않습니다.
여기서 문제는 내가 그리드를 추가하는 방법이고 contentpane에 선택을하는 것이지만 더 나은 방법을 찾을 수 없다고 생각됩니다.
감사합니다. 예, div target-node-id를 포함합니다. 이제 매장을 업데이트해야한다는 것을 알았습니다. 너는 jsonrest 가게에서 어떻게 그걸 할거야? 그것에 관한 문서를 찾을 수 없습니다. – kfk