Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Yes, that's the one.It will be called whenever the field changes with the current selection state.
Hope this helps
Erik Wetterberg
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
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
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
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);
;
});
Yes, that's the one.It will be called whenever the field changes with the current selection state.
Hope this helps
Erik Wetterberg
Yes, that seems to work. I assume that i can determine which items are selected by looking at selections from qSelectionInfo, right?
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
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.