Search code examples
qliksense

Qlik Sense Extenstions - Unable to reference Ref in properties panel (bug?)


I have the following Extension Code with a properties brought out into a separate file. As per the documentation you should be able to refence props.myTextBox within the layout object, however when using the uses: "dimensions", to build the properties section, this is not returned, is this intended or a bug?


//Properties Panel setup
define( [], function () {
    'use strict';
    // *****************************************************************************
    // Dimensions & Measures
    // *****************************************************************************
    var myTextBox = {
        ref: "props.myTextBox",
        label: "My text box",
        type: "string"
    };
    
    var dimensions = {
        uses: "dimensions",
        items: {
            myTextBox2: myTextBox, //Problem Here?
        },
    };
    var measures = {
        uses: "measures",
        min: 1,
        max:20
    };
    // *****************************************************************************
    // Appearance section
    // *****************************************************************************
    var appearanceSection = {
        uses: "settings"
    };      

    // *****************************************************************************
    // Main properties panel definition
    // Only what is defined here is returned from properties.js
    // *****************************************************************************
    return {
        type: "items",
        component: "accordion",
        items: {
            dimensions: dimensions,
            measures: measures,
            appearance: appearanceSection,
        }
    }
});

paint function

paint: function ($element,layout) {
    console.log(layout.props.myTextBox) //Undefined?
}

Solution

  • Think that the issue is that the ref should be defined as: ref: "qDef.myTextBox"

    var myTextBox = {
        ref: "qDef.myTextBox",
        label: "My text box",
        type: "string"
    };
    

    Once this is added then you can access myTextBox property in the layout for each dimension

    layout

    P.S. After making a change in the definitions make sure to re-add the extension object on the sheet.