问题
I have a Dojo dialog with content coming in from an ajax call. In the dialog I need an onLoad event (with parameters that are available only after the ajax call - so I cannot have the function called before myDialog.show()
)
The onLoad event that I have in the body tag of my jsp which is the response from the ajax call is not being called - <body onload="new_record(${record_size}, '${id}')">
Any help/hint would be very nice.
Thanks.
回答1:
Dijit dialog supports an onShow method - you can do your AJAX pull of the dialog content in the onShow method and then populate the dialog contents.
Note that dialog content is usually embedded inside a dijit contentpane or a div
dojo.connect(myDialog, "onShow", null, function(e) {
//do AJAX call
// in the callback function, populate the dialog contents
});
Also see http://www.ibm.com/developerworks/web/tutorials/wa-dojotoolkit/section7.html for an example
hth
来源:https://stackoverflow.com/questions/9091260/how-to-run-onload-event-for-a-dojo-dialog