javascript - fullcalendar eventMouseover rerenderEvents -


i using fullcalendar fork multiple resources. want use callback "eventmouseover" change border color events same title, have that:

eventmouseover: function( event, jsevent, view ) {     //get day viewed     var currentviewdate = $('#calendar').fullcalendar('getdate')      var events = $('#calendar').fullcalendar( 'clientevents', function(event) {         //get list of events displayed day         if (moment(event.start).format('yyyy-mm-dd') == currentviewdate.format('yyyy-mm-dd')) {             return true;             }     });      //search events same title event mouse on     (var = 0; events.length > ; i++) {         if (events[i].title == event.title) {             events[i].bordercolor = 'blue'             console.log(event.title)         }     }      $('#calendar').fullcalendar( 'rerenderevents') } 

and works, means changed border colors particular events, looks when put mouse on over event there strange thing, memory usage browser rapidly growing, cpu cons. 50%. looks re rendering events.

as can see code above put

console.log(event.title) 

to check how many times events particular title displayed in console.

without

$('#calendar').fullcalendar( 'rerenderevents') 

counting correct every time when put mouse pointer on event, border colors not changed,

$('#calendar').fullcalendar( 'rerenderevents') 

counting incorrect, every time when mouse pointer on event, counting in console growing , cpu cons. growing , memory well, border changed events same title in view.

is there workaround execute

$('#calendar').fullcalendar( 'rerenderevents') 

only 1 time when mouse on event? or maybe can in way.

i think problem here when rerender events, eventmouseover triggered again, causing rerender, , on, until keep mouse on event.

to prevent this, there multiple solutions, e.g.: mark event (add attribute it), , check in function, when called again, skip. of course requires when mouseout, unmark event.

another 1 use variable, if different current event title mouseover-ed, save new title , call rerender. in eventrender callback, check given event has same title, if yes, change border.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -