| Issue 701: | eventBeforeRender (callback) | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Please add eventBeforeRender callback to allow modifications of event data before the html code is generated.
Nov 10, 2010
Project Member
#1
althaus.it
Nov 10, 2010
No. I would need this method to manipulate event before HTML is injected into the grid.
Nov 11, 2010
Hmm... according to the doc on http://arshaw.com/fullcalendar/docs/event_rendering/eventRender/ it says "The eventRender callback function can modify element, return a brand new DOM element that will be used for rendering instead, or ..." But you only want to change the data and use the regular DOM creation? Doing this server sided is no solution?
Nov 12, 2010
Currently I use as workaround:
eventRender: function(event, element){
if(event.end && event.allDay != 1){
var date = event.end;
var start = Math.round(event.start.getTime()/1000/60);
var end = Math.round(event.end.getTime()/1000/60);
var mydate = date.format(response.settings['time_format']);
var html = element.html();
var title = "class=fc-event-title>" + event.title;
var newtitle = "class=fc-event-title> - " + mydate + " " + event.title;
html = html.replace(title,newtitle);
element.html(html);
if(event.id != 'preview'){
for(i=start;i<=end;i++){
occupied[i] = 1;
}
}
else{
if(occupied[start] || occupied[end]){
event.className = new Array('occupied');
rerender = true;
}
}
}
}
It works on IE8 but Firefox does not show the modified title [element.html(html);].
eventRender: function(event, element){
event.title = "new title";
}
... does not show the new title.
Nov 15, 2010
Hmm... doesn't make sense if the modified HTML works in IE and not in FF? Have you tried it with a more simplified version? Does the html.replace() the right thing?
>eventRender: function(event, element){
> event.title = "new title";
>}
That cannot work as the element is already created. This only works on the server side before fetching the events.
Nov 15, 2010
Exactly. So I asked for a eventBeforeRender callback.
Nov 15, 2010
Yeah... understood it, but nevertheless the eventRender() should work somehow. ;)
Nov 21, 2010
doesn't work in firefox b/c the .html is returning quotes around attributes, so the replace call is not matching.
doing string replacing is a messy way to do this.
if all you want to do is have arbitrary content in the title, you should to something like this:
eventRender: function(event, element) {
element.find('.fc-event-title')
.html('whatever');
}
Status:
Done
Nov 21, 2010
Thanks! Will do. Please close ticket. |
|
| ► Sign in to add a comment |