我正在尝试使用以下代码在以编程方式创建的 Dojo 对话框中使用 Dojo dgrid:
define(["dojo/_base/declare","dgrid/Grid", "dijit/Dialog"], function (declare, Grid, Dialog){
return declare("modules.egisDataGrid", null, {
showFeedBack:function(){
var myDialog = new Dialog({
title: "FeedBackList",
style: "width: 600px; height:320px;",
content: ""
});
var data = [
{ first: "Bob", last: "Barker", age: 89 },
{ first: "Vanna", last: "White", age: 55 },
{ first: "Pat", last: "Sajak", age: 65 }
];
var grid = new Grid({
columns: {
first: "First Name",
last: "Last Name",
age: "Age"
}
}, myDialog.containerNode);
grid.renderArray(data);
grid.startup();
myDialog.show();
}
});
});
对话框出现了,但布局非常混乱,如下所示:
我认为这是由于 dgrid 的初始化顺序。我已经尝试了我能想到的一切,但我仍然无法弄清楚如何正确初始化它/