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: 
matteoCalderaro
Partner - Contributor
Partner - Contributor

Qlik Sense Mashup cannot load themes

Hello everyone,

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

Labels (5)
1 Solution

Accepted Solutions
alex_colombo
Employee
Employee

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);
		});
	});
});

https://help.qlik.com/en-US/sense-developer/May2024/Subsystems/APIs/Content/Sense_ClientAPIs/Capabil...  

View solution in original post

1 Reply
alex_colombo
Employee
Employee

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);
		});
	});
});

https://help.qlik.com/en-US/sense-developer/May2024/Subsystems/APIs/Content/Sense_ClientAPIs/Capabil...