Override keyboard shortcuts 'Del'

Hello,

I want to override keyboard shortcuts, knowing that I am using customized popup ( my own popup) for event creation  ,  displaying details of the event etc ..

is there a way I can call my delete event method for a certain keyboard shortcut ?


Thank you



1 Reply

VR Vijay Ravi Syncfusion Team April 26, 2024 03:27 PM UTC

Hi Iamia,
 

Based on your requirement we prepare the sample for preventing the keyboard Delete key actions and implementing your custom function as shown in the below shared code snippet. Refer to the below shared sample for your reference.


[index.cshtml]


<script type="text/javascript">

    var scheduleElement = document.getElementById('schedule');

 

    scheduleElement.addEventListener('keydown', function (e) {

        if (e.key === 'Delete') {

            e.preventDefault();

            e.stopPropagation();

            e.stopImmediatePropagation();

 

            myDeleteMethod();

        }

    });

 

    function myDeleteMethod() {

        // Your delete logic here

    }

</script>


Please get back to us if you need any further assistance.


Regards,

Vijay


Attachment: prevent_the_delete_key_action_dc19fecf.zip

Loader.
Up arrow icon