My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 701: eventBeforeRender (callback)
1 person starred this issue and may be notified of changes. Back to list
Status:  Done
Owner:  ----
Closed:  Nov 2010


Sign in to add a comment
 
Reported by rol...@liebl.ath.cx, Nov 8, 2010
Please add eventBeforeRender callback to allow modifications of event data before the html code is generated.
Nov 10, 2010
Project Member #1 althaus.it
Doesn't eventRender() work out?
Nov 10, 2010
#2 roland.l...@gmail.com
No. I would need this method to manipulate event before HTML is injected into the grid.
Nov 11, 2010
Project Member #3 althaus.it
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
#4 rol...@liebl.ath.cx
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
Project Member #5 althaus.it
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
#6 rol...@liebl.ath.cx
Exactly. So I asked for a eventBeforeRender callback.
Nov 15, 2010
Project Member #7 althaus.it
Yeah... understood it, but nevertheless the eventRender() should work somehow. ;)
Nov 21, 2010
Project Member #8 adamrs...@gmail.com
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
#9 roland.l...@gmail.com
Thanks! Will do. Please close ticket.
Sign in to add a comment

Powered by Google Project Hosting