COPY PASTE
6 years ago.
Hello
using sample code for copy paste, i would like add a argument lieu.
// COPY Event ADD ARGUMENT : lieu: "lieu " + args.e.lieu(),
dp.onEventMove = function(args) {
if (args.ctrl) {
var newEvent = new DayPilot.Event({
start: args.newStart,
end: args.newEnd,
text: "text " + args.e.text(),
lieu: "lieu " + args.e.lieu(),
status: "A confirmer" ,
paid: "0" ,
resource: args.newResource,
id: DayPilot.guid() // generate random id DayPilot.guid()
});
dp.events.add(newEvent);
// notify the server about the action here
args.preventDefault(); // prevent the default action - moving event to the new location
}
};
// PASTE CODE lieu: "Lieu" + copied.lieu(), doesn't work
dp.contextMenuSelection = new DayPilot.Menu({items: [
{text:"Paste", onclick: function() {
if (!copied) { alert('You need to copy an event first.'); return; }
var selection = this.source;
var duration = copied.end().getTime() - copied.start().getTime(); // milliseconds
var newEvent = new DayPilot.Event({
start: selection.start,
end: selection.start.addMilliseconds(duration),
text: "Text " + copied.text(),
lieu: "Lieu" + copied.lieu(),
status: "A confirmer" ,
paid=: "0" ,
resource: selection.resource,
id: DayPilot.guid() // generate random id DayPilot.guid()
});
dp.events.add(newEvent);
// notify the server about the action here
args.preventDefault(); // prevent the default action - moving event to the new location
}
};
copied.lieu() return an error.
Uncaught TypeError: copied.lieu is not a function
Could you help me ?
DayPilot