5 Replies Latest reply: Nov 14, 2014 1:39 AM by Christian Lindholm RSS

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

    Christian Lindholm

      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

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

          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[s].value === r) {

                          n.selectedIndex = s

                      }

                  }

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

              }

          }

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

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

             

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