Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Contributor III

Selecting a value in a widget

Hello all,

I have developed a widget that takes a dimension and shows all the associated year values in a lui-select list. I have also linked this up to a function that filters the year field.  Elsewhere I apply a default filter using app.field.selectMatch Which is triggered on load. However, the widget does not show the default value as being selected.  Can anyone tell me how I can programaticaly show the selected value?

I tried using $('#widget').val('defaultyear'); but this didnt work.

Thanks in advance,


3 Replies
New Contributor

Re: Selecting a value in a widget



qsApp.getList("CurrentSelections", function(r){

  var t = "";

  var f = r.qSelectionObject.qSelections;

  var f_a = f.length;

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

        var c = f.qSelectedFieldSelectionInfo;

        var c_a = c.length;

        for (var y = 0; y < c_a; y++) {

            //Build output of selections- could be returned as object instead

            y == 0 ? t += c.qName : t += "\n" + c.qName;



  //All selection to console

  if(t !== "") { console.log(t) }


Contributor III

Re: Selecting a value in a widget

Hello Sean,

Thanks for responding.  I have looked at your example, but it seems as though it reads the selected value but does not mark the value as selected within the control so that it appears at the top of the list as it would if I manually selected a value from the list.  It is this latter step that I am asking about.


New Contributor III

Re: Selecting a value in a widget

Hi Richard,

I have same problem:



app.field("YYYYMM.autoCalendar.YearMonth").selectValues(["2011-May"], true, true); 

app.field("YYYYMM.autoCalendar.YearMonth").selectValues(["2011-01"],true, true);

app.field("=Dual(Year([YYYYMM])&'-'&Month([YYYYMM]),MonthStart([YYYYMM]))").selectValues(["2011-May"], true, true); 

app.field("=Dual(Year([YYYYMM])&'-'&Month([YYYYMM]),MonthStart([YYYYMM]))").selectValues(["2011-01"],true, true);

Manually work: