Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I recently created a Qlik Sense mashup. I encountered an issue loading the theme from the JS.
Here is my code:
require(["js/qlik"], function (qlik) {
///////// FETCH APP
var app1 = qlik.openApp('8ef91f26-c75a-4496-8903-aa0ca21ab424', config);
.....
var themeId = 'horizon';
qlik.theme.apply(themeId).then(function () {
console.log('Theme applied successfully:', themeId);
//Optional: Retrieve and log the applied theme
app1.theme.getApplied().then(function (currentTheme) {
console.log('Current applied theme:', currentTheme);
}).catch(function (error) {
console.error('Error getting applied theme:', error);
});
}).catch(function (error) {
console.error('Error applying theme:', error);
});
}
The objects in the Qlik Sense app already have the 'sense horizon' theme, however, the theme is not applied to the mashup.
Any advice?
Thanks
Hi @matteoCalderaro , you have to apply theme starting from QTheme object. You have to first get the theme, which is rertun a QTheme object, then use apply method. Below an example:
var themeId = "horizon";
qlik.getThemeList().then(function (themeList) {
console.log("themeList: ", themeList);
qlik.theme.get(themeId).then(function (theme) {
theme.apply(theme).then(function () {
console.log('Theme applied successfully:', themeId);
//Optional: Retrieve and log the applied theme
app.theme.getApplied().then(function (currentTheme) {
console.log('Current applied theme:', currentTheme);
}).catch(function (error) {
console.error('Error getting applied theme:', error);
});
}).catch(function (error) {
console.error('Error applying theme:', error);
});
});
});