6 Replies Latest reply: Nov 10, 2016 5:07 AM by Rikard Samvik RSS

    Can't use setOptions method for a visualization

    Yan Ivan Evdokimov

      There is an example of how to set options for a visualization - setOptions method ‒ Qlik Sense:

      var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');

      app.visualization.get('xGhjKl').then(function(vis){

      vis.setOptions({title:"Now improved"});

      });

      However, it is not working and giving me this error:

      Capture.PNG

      After some investigation I figured out that the problem applies only for string fields (title in example code is a string field).

      The problem can be solved by wrapping a string with single quotes:

      vis.setOptions({title:'"Now improved"'});

       

      My question is, why there is such inconsistency? To create a visualization with title option I simply can pass it without quotes:

      app.visualization.create('barchart',null,{title:"Title"});

      However if a try to setOptions for my visualization I need to wrap my title with a single quotes.


      Is it an intended behaviour or it is a bug?


      Here is a jsFiddle for this issue.

      Working:

      Edit fiddle - JSFiddle

      Not working:

      Edit fiddle - JSFiddle

       

      Message was edited by: Yan Ivan Evdokimov Added jsFiddle.