Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Community,
I have created a simple code for a button qlik selection that does not work.
Does anyone know what I did worng:
HTML:
<div id="ListYear" class="btn-group col-lg-9" style="height: 30px; margin-top: 20px;"></div>
JS:
//callbacks -- inserted here --
function ListYear(reply, app){
$("#ListYear").empty();
var qObject = reply.qListObject;
//Loop through the data returned
$.each(qObject.qDataPages[0].qMatrix, function(){
//get current item
var item = this[0];
var selT = "";
//Check to see if it's selected, if so, set the list item to bold
if(item.qState =="S"){
selT = " style=\"background-color: darkblue;\"";
}
//append the item to the list
$("#ListYear").append("<button type=\"checkbox\"" + selT + "class=\"btn btn-primary pull-right\">" + item.qText + "</button>");
});
//if user click on the button make a selection
$("#ListYear button").click(function(){
app.field('Year').selectMatch($(this).text(),false);
});
}
Kind regards
Bernhard
Are you trying this via Widget or ?
no I am using it as a mashup. I get an error that text() is not defined.