Skip to content

Instantly share code, notes, and snippets.

@mindspank
Last active January 17, 2022 05:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindspank/047852c7f5247c923354b523cd0c9018 to your computer and use it in GitHub Desktop.
Save mindspank/047852c7f5247c923354b523cd0c9018 to your computer and use it in GitHub Desktop.
Emulate a Qlik Sense sheet using the Capabilities API
var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port: "") + config.prefix + "resources"
} );
require( ["js/qlik", 'jquery'], function ( qlik, $ ) {
var app = qlik.openApp('Helpdesk Management.qvf');
var colSize = 100 / 24;
var rowSize = 100 / 12;
app.getObject('1ff88551-9c4d-41e0-b790-37f4c11d3df8').then(function(model) {
model.layout.cells.map(function(d) {
return {
id: d.name,
top: d.row * rowSize,
left: d.col * colSize,
width: d.colspan * colSize,
height: d.rowspan * rowSize
}
})
.forEach(function(d) {
$('<div id="' + d.id + '" />').css({
top: 'calc(' + d.top + '%)',
left: 'calc(' + d.left + '%)',
width: 'calc(' + d.width + '%)',
height: 'calc(' + d.height + '%)',
position: 'absolute'
}).appendTo('#grid');
app.getObject(d.id, d.id);
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment