Some calendar planner view rendering performance improvements, gives ~20% reduction in render time.

This commit is contained in:
nathangray 2017-02-13 12:41:08 -07:00
parent afa19c7d30
commit 23384d14f1
2 changed files with 7 additions and 2 deletions

View File

@ -933,7 +933,9 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
}
// Add actual events
row._update_events(events);
window.setTimeout(jQuery.proxy(function() {
this.row._update_events(this.events);
}, {row: row, events: events} ),0)
return row;
},

View File

@ -66,6 +66,8 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
this.set_start_date(this.options.start_date);
this.set_end_date(this.options.end_date);
this._cached_rows = [];
},
doLoadingFinished: function() {
@ -483,6 +485,7 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
var rows = this._spread_events();
var row = jQuery('<div class="calendar_plannerEventRowWidget"></div>').appendTo(this.rows);
var height = rows.length * (parseInt(window.getComputedStyle(row[0]).getPropertyValue("height")) || 20);
var row_width = this.rows.width();
row.remove();
for(var c = 0; c < rows.length; c++)
@ -500,7 +503,7 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
rows[c][i].div.css('top', top+'%');
rows[c][i].div.css('height', (100/rows.length)+'%');
rows[c][i].div.css('left', left.toFixed(1)+'%');
rows[c][i].div.outerWidth(width/100 *this.rows.width() +'px');
rows[c][i].div.outerWidth((width/100 * row_width) +'px');
}
}
if(height)