Checking ctrl-key during drop

6 posts, 1 answers
  1. Scott
    Scott avatar
    19 posts
    Member since:
    Mar 2011

    Posted 19 Jun 2015 Link to this post

    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.  
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 23 Jun 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Scott
    Scott avatar
    19 posts
    Member since:
    Mar 2011

    Posted 23 Jun 2015 Link to this post

    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?

  5. Answer
    Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 25 Jun 2015 Link to this post

    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!
     
  6. Peter
    Peter avatar
    44 posts
    Member since:
    Jan 2014

    Posted 26 Apr in reply to Kiril Nikolov Link to this post

    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

  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 27 Apr Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready