Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[QlikView extension][javascript] Usage of "Sortable.js" library

Hello,

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.

This is my script.js:

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" });

  });

});

My extension folder contains the following:

  • script.js
  • definition.xml
  • Sortable.min.js
0 Replies