我正在尝试使用将继续加载的备用小部件,直到加载 dojo 数据网格。我正在尝试这个。但是,待机小部件不会出现。它只是等待并加载数据。
require([
"dojox/grid/DataGrid",
"dojo/store/Memory",
"dojo/data/ObjectStore",
"dojo/request",
"dojox/widget/Standby",
"dijit/form/Button",
"dojo/domReady!",
],
function (DataGrid, Memory, ObjectStore, request, Standby, Button) {
var standby = new Standby({ target: "grid" });
document.body.appendChild(standby.domNode);
standby.startup();
standby.show();
var grid, dataStore;
request.get("MyFile.aspx", {
handleAs: "json"
}).then(function (data) {
dataStore = new ObjectStore({ objectStore: new Memory({ data: data }) });
grid = dijit.byId("grid");
grid.setStore(dataStore, { id: "*" }, {});
var struct = [
{ name: "Field1", field: "Name", width: "50%" },
{ name: "Field2", field: "Name2", width: "50%" }, ];
grid.setStructure(struct);
grid.startup();
standby.hide();