From: Alan Knowles Date: Thu, 10 Apr 2014 02:26:12 +0000 (+0800) Subject: Roo/grid/Calendar.js X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=2f490c0534abb0fcf9ebfddc0f947849d1b11b2f;p=roojs1 Roo/grid/Calendar.js --- diff --git a/Roo/grid/Calendar.js b/Roo/grid/Calendar.js index b8204243a4..a827920e93 100644 --- a/Roo/grid/Calendar.js +++ b/Roo/grid/Calendar.js @@ -790,7 +790,47 @@ Roo.extend(Roo.grid.Calendar, Roo.grid.Grid, { }, - + function renderEvent(args,ctr) { + if (!ctr) { + ctr = this.view.el.select('.fc-event-container',true).first(); + } + ev.els = []; + var cells = ev.cells; + var rows = ev.rows; + this.fireEvent('eventrender', this, ev); + + for(var i =0; i < rows.length; i++) { + + cls = ''; + if (i == 0) { + cls += ' fc-event-start'; + } + if ((i+1) == rows.length) { + cls += ' fc-event-end'; + } + + Roo.log(ev.data); + // how many rows should it span.. + var cg = this.eventTmpl.append(ctr,Roo.apply({ + fccls : cls + + }, ev.data) , true); + + + cg.on('mouseenter' ,this.onEventEnter, this, ev); + cg.on('mouseleave' ,this.onEventLeave, this, ev); + cg.on('click', this.onEventClick, this, ev); + + ev.els.push(cg); + + var sbox = rows[i].start.select('.fc-day-content',true).first().getBox(); + var ebox = rows[i].end.select('.fc-day-content',true).first().getBox(); + //Roo.log(cg); + + cg.setXY([sbox.x +2, sbox.y +(ev.row * 20)]); + cg.setWidth(ebox.right - sbox.x -2); + } + } renderEvents: function() { @@ -821,6 +861,8 @@ Roo.extend(Roo.grid.Calendar, Roo.grid.Grid, { var cls; this.eventStore.each(function(ev){ + this.renderEvent(ev); + ev.els = []; var cells = ev.cells; var rows = ev.rows;