別のファイルからajaxgoog.ui.dialog
によってコンテンツを取得できるダイアログを表示できるクラス (のような) はありますか?
- goog.ui.Dialog はこの目標に適したクラスですか?
good.net.XHR
やなどの他の基本クラスで実装しgoog.ui.Popup
ますか?
別のファイルからajaxgoog.ui.dialog
によってコンテンツを取得できるダイアログを表示できるクラス (のような) はありますか?
good.net.XHR
やなどの他の基本クラスで実装しgoog.ui.Popup
ますか?goog.ui.dialog を拡張してコンテンツを取得できます。
あなたを助けることができる簡単な例:
my.ui.Dialog = function(opt_iframe) {
goog.ui.Dialog.call(this, null, opt_iframe);
this.xhr_ = new goog.net.XhrIo();
this.xhr_.addEventListener(goog.net.EventType.COMPLETE,
this.onComplete_, false, this);
goog.events.listen(this, goog.ui.Dialog.EventType.SELECT,
this.dispatch_, false, this);
};
my.ui.Dialog.prototype.buildWindow_ = function (responseJson) {
this.setTitle(responseJson.title);
this.setContent(responseJson.content);
this.setButtonSet(eval(responseJson.buttons));
};
my.ui.Dialog.EventType = {
'COMPLETE': 'complete'
};
my.ui.Dialog.prototype.onComplete_ = function (event) {
var json = this.xhr_.getResponseJson ()
this.buildWindow_ (json);
this.reposition ();
};
my.ui.Dialog.prototype.send = function (uri, method, post_data) {
this.xhr_.send(uri, method, post_data, null, {'X-DIALOG':'AJAX'});
};
goog.inherits (my.ui.Dialog, goog.ui.Dialog);
これは、json で応答を使用して、次のように ui.Dialog を構築します。
{"buttons": "goog.ui.Dialog.Buttons.OK_CANCEL",
"content": "<html><body><h1>Hello</h1></body></html>",
"title": "Hello World"}
この例は直接動作しません:/