在Scheduler Calendar中,我在第一列中从resources.json获取资源。我正在尝试为每个资源添加事件。当我单击每个资源的插槽持续时间时,我应该会得到resourceId。因此,我会知道我正在向哪些资源添加事件。
在select函数中,Iam只能获取开始和结束时间,而不能获取resourceId。
任何帮助都将受到高度的感谢。
发布于 2015-10-21 15:07:44
select回调中有第四个参数,您可以使用它来获取资源。请参见下面的示例。
$('#calendar').fullCalendar({
select: function (start, end, calendar,res)
{
//to get resource
console.log(res);
}
});它将为您提供json对象。
要在单击资源标头时获取资源id,请在scheduler.js中进行以下更改,将下面的method.add id和class修改为资源标头。
ResourceRow.prototype.renderSpreadsheetContent = function(tr) {
.......
.......
td = $('<td id="'+resource.id+'" class="' + this.view.widgetContentClass + ' resourceHeader"/>').append(contentEl); // add id and class to the resource header.
.......
.......
}更改代码后,只需在js文件中绑定一个事件,如下所示
$(".resourceHeader").click(function(){
var resourceId=$(this).attr("id");
//write a code to get all the events of selected resource
//and render it on calendar
});你现在可以走了。谢谢
https://stackoverflow.com/questions/33249923
复制相似问题