Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Extension failed to render

Hi everyone,

I've managed to create an extension in QlikSense, who consumes a REST web service.

In Desktop mode, I see the button and extension works fine but when i'm importing this extension on server I get the message "Error : the visualization fails to render ".

Script:

define(["jquery", "text!./com-qliktech-example.css","qlik"], function($, cssContent, qlik ) {

$("<style>").html(cssContent).appendTo("head");

function createBtn(cmd, text) {

return '<button class="lui-button" style="font-size:13px;" data-cmd="' + cmd + '">' + text + '</button>';

}

function consumeWS(link) {

    $.ajax({

        type: 'GET',

        url: link,

        dataType: "json",

//processData: false,

async: true,

success: function(resp) {

                //alert("success: " + resp);

            },

            error: function (xhr, ajaxOptions, thrownError) {

                //alert("error status: " + xhr.status);

                //alert("error status text: " + xhr.statusText);

                //alert("error response text: " + xhr.responseText);

            },

    })

   return link;

}

return {

initialProperties : {

qBookmarkListDef : {

qType : "bookmark",

qData : {

title : "/title",

description : "/description"

}

},

qFieldListDef : {

}

},

definition : {

type : "items",

component : "accordion",

items : {

buttons : {

type : "items",

label : "Button Menu",

items : {

clearButton : {

ref : "buttons.clear",

label : "ClearAll",

type : "boolean",

defaultValue : true

}

}

},

field : {

type : "items",

label : "Field and field buttons",

items : {

showfield : {

ref : "field.show",

type : "boolean",

label : "Show",

defaultValue : false

},

ws : {

type: "string",

label: "Valoare WS",

ref  : 'field.ws',

expression: "always",

defaultValue: "" 

},

list : {

ref : "field.list",

component : "switch",

type : "boolean",

label : "Field",

defaultValue : true,

options : [{

value : true,

label : "List Fields"

}, {

value : false,

label : "Fixed field"

}],

show : function(data) {

return data.field && data.field.show;

}

},

fixed : {

ref : "field.fixed",

label : "Use field",

type : "string",

defaultValue : "",

show : function(data) {

return data.field && data.field.show && !data.field.list;

}

},

clearButton : {

ref : "field.clear",

label : "Clear",

type : "boolean",

defaultValue : false,

show : function(data) {

return data.field && data.field.show;

}

}

}

},

settings : {

uses : "settings"

}

}

},

support: {

snapshot: false,

export: true,

exportData: false

},

paint : function($element, layout) {

//create the app button group

var html = '', app = qlik.currApp(this);

html += '<div class="lui-buttongroup">';

if(layout.buttons.clear) {

html += createBtn("clearAll", "Salveaza Inregistrarile");

}

html += '</div><br/>';

if(layout.field && layout.field.show) {

html += '<div class="lui-buttongroup">';

//create the field btn group

if(layout.field.list && layout.qFieldList) {

html += '<select class="lui-select fields">';

layout.qFieldList.qItems.forEach( function( value) {

html += "<option value='" + value.qName + "'>" + value.qName + "</option>";

});

html += '</select>';

} else {

//display the fixed field

html += '<div class="qv-object-title">' + layout.field.fixed + '</div>';

}

if(layout.field.clear) {

html += createBtn("clear", "Clear");

}

html += '</div>';

}

$element.html(html);

$element.find('button').on('qv-activate', function() {

switch(this.dataset.cmd) {

case 'clearAll':

try {

consumeWS(layout.field.ws);

}

catch(err) {

//alert(err.message);

//alert(err.stack);

//alert(response);

   }

break;

}

});

return qlik.Promise.resolve();

}

};

});

I'm stucked here, any advice is welcome.


Paul S.

1 Reply
Anonymous
Not applicable
Author

The error i see in log : require.js:44 TypeError: Cannot read property 'resolve' of undefined.