I need to find out if I can copy and paste an event
Can you provide some more info, how do you plan to use such functionality?
There is no such possibility for now, but it sounds as interesting addition.
For instance in the calendar that I am creating now. its a weekly one for a dance school. Each class may run on say, a wednesday, friday and sunday. they all have the same info in them. ie. price, class description, instructor biography. The client that runs the school will have to be updating fairly often for the new classes when the school puts them on. It would be great for her to be able to click on “Beginners 1” and then paste it some where else, rather than having to re enter all the info.
to be able to click on “Beginners 1” and then paste it some where else, rather than having to re enter all the info
Does support for ctrl-c, ctrl-v will be enough? ( it will produce a sibling event , which can be dragged to different date after that ) or do you have some other scenario in mind?
Few niggles, I have clash management so that I do not allow events to clash.
It would be good that CTRL+V would paste the event at a starting time of where you clicked the mouse - If there was no other mouse click, it would then default to side-by-side.
Wow!! I thought you meant that you might bring something out in a few months… not a few minutes!!! cool!
Okay,
having a few dramas. I have replaced the line of code (line 353 to be exact) as you said.
I have uploaded the php file back up onto the remote server and cut and paste still does not work.
I am using a MAC is this an issue?? You use the command button instead of the cntrl button on macs.
But definitely not working for me at the moment.
I have cleared the cache and refreshed as well.
Try to update js file, it must work with both ctrl-key and command-key combinations now
But definitely not working for me at the moment.
Try to use the rigth and left cursor key, if PHP file was updated correctly, they will change active day|week. If it doesn’t works as well - it means js file was not copied to the correct location. dhtmlxscheduler_key_nav.zip (1.13 KB)
Hi Stanislav,
I was wondering if this has been included in Scheduler 2.3, and how I would go about implementing it?
Also, I have tried implementing the dhtmlxscheduler_key_nav.js file, and scheduler._select_id was always undefined. On the following section of code in dhtmlxScheduler.js
I verified by changing the dhtmlxEvent function in dhtmlxscheduler_key_nav.js to the following (I just added alerts to let me know what the _select_id is because I couldn’t copy and paste…)
cheduler._select_id was always undefined
This one set when you are clicking on some event in day|week view ( onClick must not be blocked by event handler )
There is no selection in other views. ( as there is no visual marking of selected item - ctrl-c|ctrl-v functionality will be confusing for such views )
Hi Stanislav,
I understand that there is no currently no visual marking showing which event has been selected, and therefore the user will not be able to visually see that the event they want to generate is selected to be copied, however I can perform visual marking on the element to show that it has been selected/deselected, and set the scheduler._select_id property during another event provided to the scheduler, and then the paste functionality seems fine, with the exception that the event is being pasted within the same time slot in the same section as the event I am copying, and the collision detection fails.
Is there any code I can call in the paste function of the dhtmlxscheduler_key_nav.js file too detect if collisions has been enabled in the scheduler, and detect collisions on the newly created event?
Hi Stanislav,
Thanks for your prompt and valuable response, I had noticed some unwanted behaviour but didn’t realize it was caused from that. I have ensured that key_nav uses scheduler._select_id1 and I set that variable onMouseClick using the following method:
scheduler.attachEvent("onClick", function (event_id, native_event_object){
//any custom logic here
scheduler._select_id1 = event_id;
});
And the copy and paste functionality is working correctly. Is there any way too resolve the issues I am having with the colissions when I copy and paste?
Currently, paste logic creates the copy of event at the same time as original.
As far as I can see , logic of collision extension will not check events which are added in such way - so you will be able to copy paste event, which will result in violation of collisions rules.
Do you have some ideas how both extensions can work in the same way ( ability to create copy of event at last clicked position was not implemented, because it is not intuitive and rather confusing )
Hi Stanislav,
Thanks for the fast response, I would expect the event to be pasted as it originally was, and then repositioned to a future time slot which is large enough to cater for it in the same section (I believe that this code may be part of the 2.2 collisions script, and may just need a small tweak for sections?).
Kind regards
Greg
Existing logic of collision extension is more simple - it just move event to original position or prevent new event creation if time slot already has event. So there is no logic , which can find “empty timeslot”
Technically it possible to get all events for the day, and loop through them, searching an opening. But it seems for me as quite a lot of custom code.
EDIT.
The addition of minutes would only be required to be days in my use case, but other users may have an hour/minute view so I have bought it down to minutes rather than days.
That would push it forward into an open timeslot prior to saving it.
Kind regards
Greg
// Haven't researched if this is possible too generate an array of events
// however I can generate the events in the section if required, using my own code.
var myEvents = connector.getEvents('select *RequiredFields* FROM *TableName* where sectionId=' + event.section_id + ' order by start_date);
// a variable to let us know if we have slotted in the event to an available timeslot
var hasInserted = false;
// a variable too hold the length of an event in seconds
var eventLength = dateDiff(event.start_date, event.end_date);
for(i; i<myEvents.length; i++)
{
// A variable to hold the difference between the end date of the current
// event and the start date of the next event in seconds from the myEvents array
var timeSlot = dateDiff(myEvents[i].end_date, myEvents[i +].start_date);
if(timeSlot >= eventLength)
{
hasInserted = true;
event.start_date = myEvents[i].end_date;
event.end_date = event.start_date.addSeconds(eventLength);
}
}
if(hasInserted == false)
{
event.start_date = myEvents[myEvents.length].end_date;
event.end_date = event.start_date.addSeconds(eventLength);
}
scheduler._date = new Date(event.start_date);