So I'm using the Scheduler plugins from FullCalendar library version 3. I already have my event system working, letting me edit events on click via a modal box.
Now I would like to do the same with resources but I'm hitting a wall there.
Among other things, I tried this
resourceRender: function(resource, cellEls) {
cellEls.on('click', function(resource) {
$.getScript(resource.edit_url);
})
}
But I can't access resource inside cellEls method.
I did not find any example of this so I'm not even sure it's possible.
Any ideas ? Thanks in advance
The first argument to any "click" callback is the JavaScript event object. You can't change that.
Simply allow the "resource" object to propagate down into the event handler naturally instead of trying to re-declare it:
resourceRender: function(resource, labelTds, bodyTds) {
labelTds.on('click', function(event) {
console.log(resource);
$.getScript(resource.edit_url);
});
}