如何为Dojo对话框运行onLoad事件? [英] How to run onLoad event for a Dojo Dialog?
问题描述
我有一个Dojo对话框,其内容来自ajax调用.在对话框中,我需要一个onLoad事件(其参数仅在ajax调用之后才可用-因此我不能在 myDialog.show()
之前调用该函数)我的jsp的body标签中的onLoad事件是ajax调用的响应,没有被调用-< body onload ="new_record($ {record_size},'$ {id}')">
任何帮助/提示都将非常好.谢谢.
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.
推荐答案
Dijit对话框支持onShow方法-您可以在onShow方法中对对话框内容进行AJAX提取,然后填充对话框内容.
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.
请注意,对话框内容通常嵌入在dijit contentpane或div内
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
});
另请参阅 http://www.ibm.com/developerworks/web/tutorials/wa-dojotoolkit/section7.html 例如
hth
这篇关于如何为Dojo对话框运行onLoad事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!