Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
mattsemp
Contributor
Contributor

Sorting a Bookmark List

Hey All,

I am very new Qlik Sense and was tasked to build an extension that allows for bookmarks to be accessed via a dropdown. I found that the "toolbar" example had this built out already, but there were two issues:

1. You had to click an "apply" button to load the bookmark. I was asked to remove the button and have it load when selected. (I fixed this and made it load "onchange")

2. Due to a custom naming convention, I was asked that the bookmarks be sorted alphabetically.

I need some help on number 2.  The code I need help on is below.


paint : function($element, layout) {
var html = '', app = qlik.currApp(this);
if(layout.bookmark && layout.bookmark.apply && layout.qBookmarkList) {
html += '<div class="lui-buttongroup">';
html += '<select class="lui-select bookmark_list"><option value="" selected="">Select a Bookmark</option>';
layout.qBookmarkList.qItems.forEach( function(a) {
if(a.qMeta && a.qMeta.title) {
html += "<option value='" + a.qInfo.qId + "'>" + a.qMeta.title + "</option>";
}
}
);
html += '</select>';
}
$element.html(html);
var $fields = $element.find(".fields"),
$bookmarks = $element.find(".bookmark_list").on('change',function() {app.bookmark.apply($bookmarks.val());});

 

Side note: I only have access to the web version of Qlik Sense.

0 Replies