我真的很感激任何幫助。有這個Dojox Datagrid,我正在編程創建並提供JSON數據。截至目前,我正在JavaScript本身內創建這些數據。請參考下面的代碼示例。Dojox Datagrid包含數據,但顯示爲空
var upgradeStageStructure =[{
cells:[
{
field: "stage",
name: "Stage",
width: "50%",
styles: 'text-align: left;'
},
{
field:"status",
name: "Status",
width: "50%",
styles: 'text-align: left;'
}
]
}];
var upgradeStageData =
[
{id:1, stage: "Preparation", status: "Complete"},
{id:2, stage: "Formatting", status: "Complete"},
{id:3, stage: "OS Installation", status: "Complete"},
{id:4, stage: "OS Post-Installation", status: "In Progress"},
{id:5, stage: "Application Installation", status: "Not Started"},
{id:6, stage: "Application Post-Installation", status: "Not Started"}
];
var stagestore = new dojo.data.ItemFileReadStore({data:{identifier:"id", items: upgradeStageData}});
var upgradeStatusGrid = new dojox.grid.DataGrid({
autoHeight: true,
style: "width:400px;padding:0em;margin:0em;",
store: stagestore,
clientSort: false,
rowSelector: '20px',
structure: upgradeStageStructure,
columnReordering: false,
selectable: false,
singleClickEdit: false,
selectionMode: 'none',
loadingMessage: 'Loading Upgrade Stages',
noDataMessage:'There is no data',
errorMessage: 'Failed to load Upgrade Status'
});
dojo.byId('progressIndicator').innerHTML='';
dojo.byId('progressIndicator').appendChild(upgradeStatusGrid.domNode);
upgradeStatusGrid.startup();
問題是我沒有看到任何顯示在網格內的東西(沒有標題,沒有數據)。但我確實知道網格中的數據確實存在,網格已正確初始化,因爲我調用了alert (grid.domNode.innerHTML);
。由此產生的HTML不會顯示包含標題行和上述數據的表格。
This link包含一個圖像,說明當我顯示頁面時看到的內容。 (由於我的帳戶是新的,因此無法發佈圖片)
正如您可能注意到的,我創建的6條數據有6行,但網格很混亂。如果你認爲你知道什麼可能會出錯,請幫忙。
由於提前, 薇薇
你可以在這裏用這個演示嗎? http://www.jsfiddle.net/ – Eric 2010-03-01 07:14:12
Eric,我會這樣做的。但是,請您檢查我的更新嗎?謝謝。 – viv 2010-03-04 10:45:15