Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

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;

  }

  var foo = document.getElementById('listitems');

  Sortable.create(foo, { group: "omega" });

  });

});

Kind regards,

Markus

0 Replies