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

Checking ctrl-key during drop

5 Answers 192 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 19 Jun 2015, 08:40 PM
Is there any way to check the status of the ctrl-key during a drop event?  I've tried monitoring the state of the ctrl key tracking the mouseup event in the treeview element but it doesn't fire when the drop is completed.  What I'm trying to accomplish is to only "copy" the node (rather than move it) if the user drags the node to another node when the ctrl key is held down.  

5 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 23 Jun 2015, 11:40 AM
Hi Scott,

You can check the event argument that will be actual dom event where you can check the ctrl key. Here is an example:

http://dojo.telerik.com/oreVa

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Scott
Top achievements
Rank 1
answered on 23 Jun 2015, 02:22 PM

Thanks for the answer, but e.ctrlKey is undefined during the treeview drop event.  I define my treeview like this:

 

<div class="files"
                      id="treeview"
                     data-role="treeview"
                     data-drag-and-drop="true"
                     data-text-field="name"
                     data-spritecssclass-field="type"
                     data-bind="visible: isVisible, source: files, events: { drop: onNodeDrop, select: onNodeSelect } ">
                </div>

 I bind it like this:

jobBookAPI.viewModel = kendo.observable({
                    isVisible: true,
                    onNodeSelect: function (e)
                    {
                    },
                    onNodeDrop: function (e) // Internal drop handler (node to node).
                    {
                        alert(e.ctrlKey); // This is undefined
                    },
                    files: kendo.observableHierarchy(jobBookAPI.directoryContents)
                });
                kendo.bind($("#example"), jobBookAPI.viewModel);

e.ctrlKey is undefined in the onNodeDrop event.  Any idea why?

0
Accepted
Kiril Nikolov
Telerik team
answered on 25 Jun 2015, 08:07 AM

Hello Scott,

 

Since the latest release there is the originalEvent argument:

 

http://dojo.telerik.com/UXiSA

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Peter
Top achievements
Rank 1
answered on 27 Apr 2016, 01:23 AM

Can this work somehow with a 'change' event on a ComboBox?

I want to detect whether Ctrl is being held when a ComboBox item is selected/chosen.

But I cannot find any similar property passed by kendo in the change event parameter

0
Kiril Nikolov
Telerik team
answered on 27 Apr 2016, 08:07 AM
Hi,

The Combobox is a different widget that does not expose such event. Please send us a separate support request with some more detailed explanation, so we can see what can be done in your case.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Scott
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Scott
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Share this question
or