PDA

View Full Version : drag copy and drop in calendar



patreya
9 Aug 2013, 9:19 AM
Hi,

I am beginner with extjs. can anyone help me with how I can use the drag function to copy an event (instead of move) in the example calendar provided with extjs.

Thanks,
Prakash

tobiu
9 Aug 2013, 9:29 AM
take a look at:
ext-4.2.1.883/examples/calendar/src/view/AbstractCalendar.js



// private
onEventDrop: function(rec, dt) {
if (Ext.calendar.util.Date.compare(rec.data[Ext.calendar.data.EventMappings.StartDate.name], dt) === 0) {
// no changes
return;
}
var diff = dt.getTime() - rec.data[Ext.calendar.data.EventMappings.StartDate.name].getTime();
rec.set(Ext.calendar.data.EventMappings.StartDate.name, dt);
rec.set(Ext.calendar.data.EventMappings.EndDate.name, Ext.calendar.util.Date.add(rec.data[Ext.calendar.data.EventMappings.EndDate.name], {millis: diff}));

this.fireEvent('eventmove', this, rec);
}


You probably want to change that in case you want to change move to copy.