我正在使用fullCalendar jquery插件和主干构建约会日历。 我在这里阅读本教程:enter link description here
在“让我们开始一个对话框”部分中,显示了如何创建模态框并输入新事件的代码,代码基于jquery UI的对话框小部件,enter link description here
这里是具体的代码:
render: function() {
this.el.dialog({
modal: true,
title: 'New Event',
buttons: {'Cancel': this.close}
});
我要做的是在该对话框中添加更多html。我想添加一个select元素,以便用户可以选择约会的持续时间。
http://api.jqueryui.com/dialog/中的jquery文档并未说明如何执行此操作。 为了更好地了解我想要做的是查看在outlook.com日历上创建活动时出现的模式框。
当然,数据将与ajax一起发送......但这是一个不同的主题。
答案 0 :(得分:1)
jqueryui对话框使用html内容,该内容位于您正在应用插件的元素内。
我认为它没有内置功能来从外部资源加载内容。
因此,您可以在初始化对话框之前将html放在元素内,或使用其回调。 例如。如果你想通过ajax加载数据:
el.dialog({
modal: true,
title: 'New Event',
buttons: {'Cancel': this.close},
open: function(){
var thisdialog = this;
$(thisdialog).html('loading data...');
$.post('external_resouce.html',
function(data){
$(thisdialog).html(data);
}
);
}