I'm having a little problem with javascript in an QlikView extension. I want to use the Sortable library. But unfortunately my code doesn't work. I can create a list of items. But the Sortable.create has no effect.
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() {
//create element variable
var e = this.Element;
//Destroy previous content
$(e).empty();
//create an UL-list element
var ul = document.createElement('ul');
ul.setAttribute('id','listitems')
e.appendChild(ul);
//input texts
var texts = ['ratatat','matatat','hatatat'];
//load input texts into LI-list-items
for (var i = 0; i < 3; i++){
var li = document.createElement('li');
ul.appendChild(li);
li.innerHTML="";
li.innerHTML += texts;
}
//get all listitems
var foo = document.getElementById('listitems');
//create Sortable object
Sortable.create(foo, { group: "omega" });
});
});