This is a migrated thread and some comments may be shown as answers.

Keyboard shortcuts

3 Answers 65 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 15 Oct 2010, 01:09 PM
Hi,

We are considering using RadScheduler for a new project and we have one question. The client has a specific request to be able to copy and paste appointments using keyboard shortcuts (ctrl+c and ctrl+v). 

Can this be done?

Thanks,
Daryl

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 16 Oct 2010, 05:23 PM
Hello Daryl,

Unfortunately using keyboard combinations for copy/paste of appointments is not available at this moment.

All the best,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alan
Top achievements
Rank 1
answered on 18 Oct 2010, 11:53 AM
Hi Veronica,

I may have found a workaround to this problem.

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
     <script type="text/javascript">
         var selectedApt;
         var activeTimeslot;
         var copiedApt;
 
         function OnClientAppointmentClick(sender, eventArgs) {
             if (eventArgs.get_appointment()) {
                 selectedApt = eventArgs.get_appointment();
             }
         }
 
         function OnClientTimeSlotClick(sender, eventArgs) {
             if (eventArgs.get_targetSlot()) {
                 activeTimeslot = eventArgs.get_targetSlot();
             }
         }
 
         function onKeyDown() {
             // current pressed key
             var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
 
             if (event.ctrlKey && pressedKey == "c")
             {
                 copiedApt = selectedApt;
             }
 
             if ((event.ctrlKey && pressedKey == "v") && copiedApt && activeTimeslot) {
                 var newAppointment = new Telerik.Web.UI.SchedulerAppointment();
                 var startTime = activeTimeslot.get_startTime();
                 var endTime = new Date(activeTimeslot.get_startTime());
                 endTime.setTime(endTime.getTime() + copiedApt.get_duration());
                  
 
                 newAppointment.set_start(startTime);
                 newAppointment.set_end(endTime);
                 newAppointment.set_subject(copiedApt.get_subject());
 
                 var scheduler = $find('<%= RadScheduler1.ClientID %>');
                 scheduler.insertAppointment(newAppointment);
 
                 activeTimeslot = null;
             }
         }
     </script>
 </telerik:RadScriptBlock>


Many Thanks,
Daryl
0
Veronica
Telerik team
answered on 18 Oct 2010, 03:28 PM
Hello Daryl,

I'm glad you've found a solution. Yes, catching the key pressed via Javascript is the way for solving this.

Please feel free to ask me if you have further questions.

All the best,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
Alan
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Alan
Top achievements
Rank 1
Share this question
or