iLemming
iLemming

Reputation: 36166

fullcalendar event title. I don't want it to be repeated on every line

if you have an event that lasts for more than one week, fullcalendar repeats event's title on each every line. How can I override that? I need to show the title only once. enter image description here

Upvotes: 2

Views: 1413

Answers (4)

dax
dax

Reputation: 10997

Titles are rendered in this div

fc-event fc-event-hori fc-event-start

and following weeks, if part of the same event are rendered without the fc-event-start class, like so

fc-event fc-event-hori

So the best solution is something like this:

eventAfterRender: function(event, element, view) {
    if (!$(element).hasClass('fc-event-start'))
        $(element, 'fc-event-title').text('');
    };
}

Upvotes: 0

iLemming
iLemming

Reputation: 36166

As Andreas described, in callback of eventAfterRender we can get rendered element. And the front and tail of the element would have fc-corner-left and fc-corner-right classes. So we can do something like that:

eventAfterRender: function (event, element, view) {
    if (!$(element).hasClass('fc-corner-left'))
{
   $(element, "a").text("");
    }
}

Upvotes: 1

user57508
user57508

Reputation:

oh yes ... some investigation:

hook to eventAfterRender-handler: function( event, element, view ) { }. so, you've got the event, to determine it's start- and end-date, you've got the element, to determine which part of the event is drawn ... now put this information all together, et voilà ...

Upvotes: 1

Piotr Kula
Piotr Kula

Reputation: 9821

I would be tempted to use jquery and try to find the actual event DOM and see how it is constructed and remove/hide the text on all lines except the first. Sorry I don not have an example to post.

Otherwise you would have to go into the core js and find the method buildSkeleton() and find how the text is added and try to put some logic in there.

Upvotes: 0

Related Questions