How do you retrieve the icon for a widget instance? - Community forums - Akumina Community

Community forums

Forum Navigation
You need to log in to create posts and topics.

How do you retrieve the icon for a widget instance?

Let's say you want to build some kind of implementation to display a list of widget instances. Sounds easy, right?

Well, what if you wanted the icon tied to the INSTANCE to be displayed next to the Instance, instead of the icon tied to the Widget definition itself? This is also easy! The Akumina Framework features a great deal of Javascript Abstracted APIs to help you do this with ease. Consider the following snippet:

 

function getWidgetIcons(instanceId) {
varwidgetHandler=newAkumina.Digispace.Data.WidgetManager();
widgetHandler.GetWidgetInstances().then(function(response) {
console.log('Good call!');
varfilteredList=response.filter(function(item) { returnitem.widgetId==instanceId});
if (filteredList.length==0) {
console.log('No results found!');
} else if (filteredList.length > 1) {
console.log('Multiple instances found with duplicate IDs!');
} else {
vardesiredItem=filteredList[0];
console.log('Widget Found: Name ['+desiredItem.widgetName+'] - Icon ['+desiredItem.widgetIcon+']');
}
debugger;
});
};
getWidgetIcons('WIDGET INSTANCE ID');
The function can be changed to take an array instead of a single object. Be sure to tailor this to your own needs, as well as removing the console logging and debugger. Both have been left in for visibility of data.
Cheers!

Awesome!

//]]>