Fullcalendar Scheduler: resourceRender can't seem to access the all-day td cells


Fullcalendar Scheduler: resourceRender can't seem to access the all-day td cells



I'm trying to use the "resourceRender" callback in fullcalendar scheduler to dynamically hide resource columns from the agenda day view.



The callback function supplies labelTds and bodyTds parameters by default, but bodyTds is empty in agenda view. I thought I could select the tds using jquery but it doesn't select the all-day row cells. I expected the code below to color all the cells red but maybe those tds aren't loaded yet when resourceRender fires. Can this be done?


calendar = $CALENDAR.fullCalendar({
resourceRender: function(resource, labelTds, bodyTds){
if (bodyTds.length === 0) {
bodyTds = $("td").find(`[data-resource-id=${resource.id}]`);
}
labelTds.css("background-color", "red");
bodyTds.css("background-color", "red");
}
});



DEMO IMAGE



JSFiddle



Image of where the red should be (see "red" labels)





create js fiddle and share full code!!
– Bhumi Shah
Jun 29 at 5:50





@BhumiShah I added a JSFiddle demonstrating the issue. Thanks.
– bruderdog
Jun 29 at 21:34





Seems like a bit of a bug to me really...I'd raise it, assuming no-one already has: fullcalendar.io/reporting-bugs
– ADyson
Jun 30 at 19:32





@ADyson Fair enough. I'll report if it hasn't been already. In fairness, the documentation states that the labelTds and bodyTds params are not available in certain views, but I thought I could get around that by manually selecting them with JQuery. I think the all-day tds elements are not yet created when resourceRender fires so there is nothing to select.
– bruderdog
Jun 30 at 20:19




1 Answer
1



Here i have changed code to apply red color to all tds:
https://jsfiddle.net/0sergv3y/57/


.fc-unthemed td.fc-today{
background-color:red;
}





This doesn't color the all-day bodyTds for the initial view, only subsequent view changes seem to work. This is what I see: imgur.com/a/17mkLFJ
– bruderdog
Jun 30 at 20:15





Also this solution targets all tds on the page which is not an ideal approach.
– bruderdog
Jun 30 at 20:22





can you create an image of what you want in red?
– Bhumi Shah
Jul 2 at 7:11





I added an image to the original post showing the cells I want to affect.
– bruderdog
Jul 2 at 19:30





You can do it simply overridding css!! updated above!!
– Bhumi Shah
Jul 3 at 5:21







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages