Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
bernhard2760
Partner - Contributor III
Partner - Contributor III

Button clik selection does not work

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

Labels (3)
2 Replies
Anil_Babu_Samineni

Are you trying this via Widget or ?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
bernhard2760
Partner - Contributor III
Partner - Contributor III
Author

no I am using it as a mashup. I get an error that text() is not defined.

console.log(text).png