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: 
celindho
Partner - Creator
Partner - Creator

Definition.xml - Text with type=select does not work?

Hi,

I just tried building an extension where one of the Text properties is defined as a drop down (Type=select). I have not defined a properties.qvpp but instead QlikView creates the DynProperties.qvpp page.

Using this combination, it appears that the property this.Layout.Text0.text will always be empty in the javascript, regardless of what i select in the properties window of the extension. Have i stumbled upon a bug or how should i proceed to make a working drop down property in the extension?

This is my Definition.xml:

<?xml version="1.0" encoding="utf-8"?>

<ExtensionObject Label="Test" Description="Dropdown test">

    <Text Label="Target Type" Initial="high" Type="select" Select="high,low" SelectLabel="High,Low" />

</ExtensionObject>

This is my script.js:

var template_path = Qva.Remote + "?public=only&name=Extensions/Test/";

Qva.AddExtension('Test', function() {

  this.Element.innerHTML = "<H1 style='text-align: center; color: #AB34F3;'>Placeholder</H1>";

  this.Element.firstChild.innerText = this.Layout.Text0.text;

});

The extension always shows without any content, not "High" or "Low".

Any help is appreciated!

-Christian

5 Replies
Not applicable

I don't remember where I found this (probably somewhere on here) but I tried this myself and in order to get it to work I had to include the following in my script.js

// This is needed so that we can retrieve and react to selections in the extension properties when using the select type

if (Qva.Mgr.mySelect == undefined) {

    Qva.Mgr.mySelect = function (e, t, n, r) {

 

        if (!Qva.MgrSplit(this, n, r)) return;

        e.AddManager(this);

        this.Element = t;

        this.ByValue = true;

        t.binderid = e.binderid;

        t.Name = this.Name;

        t.onchange = Qva.Mgr.mySelect.OnChange;

        t.onclick = Qva.CancelBubble

    };

    Qva.Mgr.mySelect.OnChange = function () {

        var e = Qva.GetBinder(this.binderid);

        if (!e.Enabled) return;

        if (this.selectedIndex < 0) return;

        var t = this.options[this.selectedIndex];

        e.Set(this.Name, "text", t.value, true)

    };

    Qva.Mgr.mySelect.prototype.Paint = function (e, t) {

        this.Touched = true;

        var n = this.Element;

        var r = t.getAttribute("value");

        if (r == null) r = "";

        var i = n.options.length;

        n.disabled = e != "e";

        for (var s = 0; s < i; ++s) {

            if (n.options.value === r) {

                n.selectedIndex = s

            }

        }

        n.style.display = Qva.MgrGetDisplayFromMode(this, e)

    }

}

Not applicable

Here is the thread where I found the answer I posted. It worked for me.

http://community.qlik.com/thread/53335

celindho
Partner - Creator
Partner - Creator
Author

Thanks!

Got it working using this code

Seems like a bug in QlikView...

BR,

-Christian

Not applicable

Hi Christian,

Is this solution still working for you even after you hit F5? I also tried this but it seems only to work until you hit F5 to refresh the webview. After that I cant select a new value, it keeps the value selected before the F5.

Thanks in advance!

Kenneth

celindho
Partner - Creator
Partner - Creator
Author

Hi Kenneth,

The solution seems to work fine for me. At one point I had a problem where, after a reload of the page (F5), the properties page of the extension did show the default value of the drop down instead of the one that had been selected before hitting reload.

In our case we have been doing the development and testing in the ajax client, don't know if that matters.

BR,

-Christian