4 Replies Latest reply: Sep 1, 2011 3:13 PM by Stefan Stoichev RSS

    Pre populated values in dropbox in qvpp?

      Hi all,


      is it possible to have pre populated values in extension properties panel? My idea is to have a dropbox from which user can select the extension chart type (something like bar, line, combo) but the cart types are not defined as field/dimension.





        • Pre populated values in dropbox in qvpp?
          Erik Wetterberg

          Yes, its possible. With version 11 it is included in the framework, in version 10 you need to add it in your extension code.


          In the qvpp file you write something like this:


          <select avq='textSelect:.Chart.Text.0.Content'>

                   <option value="topleft">Top Left</option>

                   <option value="topright">Top Right</option>

                   <option value="bottomleft">Bottom Left</option>

                   <option value="bottomright">Bottom Right</option>



          The textSelect object is included in version 11, in 10 you can create it like this:

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

              Qva.Mgr.textSelect = function(owner, elem, name, prefix) {

                  if (!Qva.MgrSplit(this, name, prefix)) return;


                  this.Element = elem;

                  this.ByValue = true;


                  elem.binderid = owner.binderid;

                  elem.Name = this.Name;


                  elem.onchange = Qva.Mgr.textSelect.OnChange;

                  elem.onclick = Qva.CancelBubble;


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

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

              if (!binder.Enabled) return;

              if (this.selectedIndex < 0) return;

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

              binder.Set (this.Name, 'text', opt.value, true);   


             Qva.Mgr.textSelect.prototype.Paint = function(mode, node) {

                  this.Touched = true;

                  var element = this.Element;

                  var currentValue = node.getAttribute("value");

                  if (currentValue == null) currentValue = "";

                  var optlen = element.options.length;

                  element.disabled = mode != 'e';

                  for (var ix = 0; ix < optlen; ++ix) {

                       if(element.options[ix].value === currentValue){

                          element.selectedIndex = ix;



                  element.style.display = Qva.MgrGetDisplayFromMode(this, mode);       



            • Pre populated values in dropbox in qvpp?

              Hi Erik,


              thanks for your reply. I've put the js code into QvAjaxBaseMgr.js and edited the qvpp file but when try to get the value from the dropbox (this.Layout.Text0.text) i've got and empty string. Did i miss something?




                • Re: Pre populated values in dropbox in qvpp?
                  Erik Wetterberg

                  Hi Stefan,

                  Getting the properties value in the extension javascript code can be a bit tricky. In my extension I do like this:


                  var legendPos = this.Layout.Text0 ? this.Layout.Text0.text : "bottomright";


                  Also I think you should avoid modifying the standard scripts, do not put any code in QvAjaxBaseMgr.js, it might not work (since the minified QvAjax.js is the file that is actually used) and you will have problems installing it and upgrading your server. You can create the textSelect object in the extensions javascript file but not in the AddExtension function.


                  And when you add properties to your extension you need to remove the object from the document and add it back again.