Search code examples
javascriptangularjshtmldashboard

Can't use "draggable" inside an Angular Dashboard Framework Widget


I'm trying to use an draggable element inside an adf-widget, but it seems that draggable="true" is ignored inside adf-widgets.

i've tried the simplest way with, to test if draggable="true" is working:

<div style="background-color: #000000; width: 50px; height 50px;" draggable="true">...</div>

but it wont become draggable. Is there an other way to get an element draggable?


Solution

  • It seems that ADF-Wigets are overwriting "draggable attributes". I resolved this issue using ngMouseenter and javascript like:

    <div class="draggable-element" ng-repeat="item in itemlist" id="{{item.id}} ng-mouseenter="setDraggable(item.id)>{{item.name}}</div>
    

    And inside my controller:

    $scope.setDraggable = function(id){
       document.getElementById(id).setAttribute('draggable', true);
    };