Skip to content

Qlik Sense properties #12

@k0zm0

Description

@k0zm0

Hello, I've been using this great extension for a while and I've tried to reduce some harcoded options.
I've tested this workaround :

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

    return {
        initialProperties: {
            version: 1.0,
            qHyperCubeDef: {
                qDimensions: [],
                qMeasures: [],
                qInitialDataFetch: [{
                    qWidth: 2,
                    qHeight: 500
                }]
            }
        },
        definition: {
            type: "items",
            component: "accordion",
            items: {
                
                settings: {
                    uses: "settings",
                    items: {
                        reload: {
                            label: "Reload Type",
                            ref: "reload_partial",
                            type: "boolean",
                            defaultValue: false,
                            component: "switch",
                            options: [{
                                "label": "Partial",
                                value: false
                            }, {
                                label: "Full",
                                value: true
                                }]
                        },
                        btn_text: {
                            ref: "caption",
                            label:"Button Caption",
                            type: "string",
                            defaultValue: "Reload"
                        }
                    }
                }
            }
        },
        snapshot: {
            canTakeSnapshot: false
        },
        paint: function ($element, layout) {
                [...]
        }

To get the values inside the paint function:

var caption = layout.caption;
if (caption === undefined || caption === null ||  caption.length<1){
        caption = "Reload";
}

And using it in the output:
var html = html = '<a href="#" id="modal-open" class="btn btn-primary">' + caption +'</a>';
And inside the 'click' event on selector $("#execute-reload")
var isPartial= !layout.reload_partial;

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions