naspinski
naspinski

Reputation: 34699

Why is Kendo Draggable and Kendo DropTarget only working some of the time/

I have been able to get it working, but only part of the time - as in some drags will register, but others will slide back to the original spot and not work. This is as stripped down as I can make it not work:

<div>
    <div id="drop" style="border: solid 1px green; ">
        bla<br />bla<br />bla<br />bla<br />bla<br />
    </div>
    <ul>
        <li id="t5" style="border:solid 1px red;">T5</li>
    </ul>
</div>

<script type="text/javascript">
    $(function () {
        $('#t5').kendoDraggable({
            hint: function (e) {
                return e.clone();
            }
        });

        $('div#drop').kendoDropTarget({
            drop: function (e) { console.log(e); }
        });
    });
</script>

With that, the drops will not register (nothing gets logged), but if I simply change 'div#drop' to 'body' (so it catches everything), the drop will log. What am I not understanding? I have nothing else on this test page other than a jquery 1.8.2 reference and kendo. Thank you.

Upvotes: 0

Views: 2634

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30671

I tried your code in a demo but it worked as expected. Which browsers are you testing with?

I have a theory that this could be happening because your draggable is a li which can be inserted only in an ul. You can try the following modification:

    $('#t5').kendoDraggable({
        hint: function (e) {
            var ul = $("<ul/>");
            ul.append(e.clone());
            return ul;
        }
    });

Upvotes: 0

Related Questions