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: 
rbartley
Specialist II
Specialist II

Qlik Sense Mashups - event for responding to selections

Hello all,

What is the best way of picking up when a change has been made to a QS filter panel element?  Is it to simply use the $("#FilterPanelID").change() event?  Is there any way of referring to individual elements within a filter panel?


Thanks in advance.


Richard

1 Solution

Accepted Solutions
ErikWetterberg

Yes, that's the one.It will be called whenever the field changes with the current selection state.

Hope this helps

Erik Wetterberg

View solution in original post

8 Replies
ErikWetterberg

Hi Richard,

Do you really want to listen to selection made just in the filter panel, not through for example the selection toolbar, a chart or with a bookmark? In that case you probably need some reverse engineering och the filter panel.

If you want to listen to all selection made in a specificerat field, you can use the createList method: createList method ‒ Qlik Sense.

Hope this helps

Erik Wetterberg

rbartley
Specialist II
Specialist II
Author

Hello Erik,

Thank you for replying.   Unfortunately, the Qlik Help page did not provide any examples of how this would work.  Are you suggesting that if I add a filter panel and also create lists for each of the fields contianed within the filter panel then I can somehow check for an onchange event?  I would be grateful if you could provide a small example.

Richard

ErikWetterberg

Hi,

I suggestiv you create a list, pretty much like the code example in the helps, for each field you want to listen to changes for. Every time there is a change in selection that affect this field your callback funktion will be called.

Hope this helps

Erik Wetterberg

rbartley
Specialist II
Specialist II
Author

Thanks again Erik.  When talking about the callback function are you referring to the anonymous function that begins on line 12 below?app.createList({

  "qDef": {

  "qFieldDefs": [

  "[Year]"

  ]

  },

  "qInitialDataFetch": [{

  qTop : 0,

  qLeft : 0,

  qHeight : 40,

  qWidth : 1

  }]

  }, function(reply) {

  var str = "";

  $.each(reply.qListObject.qDataPages[0].qMatrix, function(key, value) {

  str += '<li>' + value[0].qText + '</li>';

  });

  $('#list').html(str);

  ;

  });

ErikWetterberg

Yes, that's the one.It will be called whenever the field changes with the current selection state.

Hope this helps

Erik Wetterberg

rbartley
Specialist II
Specialist II
Author

Yes, that seems to work.  I assume that i can determine which items are selected by looking at selections from qSelectionInfo, right?

ErikWetterberg

Not really, I'm afraid. You should look at qState in the cells, documented as NxCell here:ListObject ‒ Qlik Sense. There is also a count of # of values in the different state in qDimensionInfo: NxDimensionInfo ‒ Qlik Sense

Hope this helps

Erik Wetterberg

rbartley
Specialist II
Specialist II
Author

Yes, I'd spotted that while looking at qMatrix, but thought that there might be a shortcut to having to loop through all of the values.  Oh well, never mind.  Thank you very much for your help.