0 Replies Latest reply: Jun 29, 2017 5:39 AM by Markus Haindl RSS

    [QlikView extension][javascript] Sortable.js-library doesn't work

    Markus Haindl

      Hello,

       

      I've a problem with javascript. I've tried to use the Sortable.js library. But I don't succeed yet. The UL-list with its list items is there but I can't get the sorting mechanism working

       

      My extension folder contains: definition.xml, script.js and the Sortable.min.js

      And that's my script.js code

      var EXTENSION_NAME = "HelloWorld"
      var remoteUrl = Qva.Remote + (Qva.Remote.indexOf("?") >= 0 ? "&" : "?") + "public=only&name=Extensions/" + EXTENSION_NAME;
      var jsFiles = [remoteUrl + "/Sortable.min.js"];
      Qv.LoadExtensionScripts(jsFiles, function() {
        Qva.AddExtension(EXTENSION_NAME, function() {    
        var e = this.Element;
        $(e).empty();
        var ul = document.createElement('ul');
        ul.setAttribute('id','listitems')
        e.appendChild(ul);
        var texts = ['ratatat','matatat','hatatat'];
      
        for (var i = 0; i < 3; i++){
        var li = document.createElement('li');
        ul.appendChild(li);
        li.innerHTML="";
        li.innerHTML += texts[i];
        }
      
        var foo = document.getElementById('listitems');
        Sortable.create(foo, { group: "omega" });
        });
      });
      

       

      Kind regards,

       

      Markus