Environment: JS client side.
I have some issues made with Data Visualization SpriteViewables in my model, and the selection works, changing the svg url to the highlightedUrl
, example:
In my application, I have an issues list like this:
I want that on click in an issue in this list, select the current sprite issue in model (changing the svg url to the highlightedUrl
), I already have an auxiliary list containing all sprites dbIds
and issue.id
, with this list I have the relation between the clicked issue on the list (second image) and the sprite in model.
Having a closer look into the viewable data in data visualization, the Sprite Viewable object doesn't have a key like 'currentUrl' to change:
So it has to be another way.
When selecting/clicking on a sprite viewable, the icon of the clicked sprite viewable will become the highlightedUrl
one in the style with my test. On the contrary, the icon will be changed back to the url
one.
To do this programmatically, we can do the following:
let dataVizExt = viewer.getExtension('Autodesk.DataVisualization');
// Select a sprite viewable
dataVizExt.highlightViewables( [ spriteViewableDbId ] );
viewer.impl.invalidate( false, false, true );
// Deselect viewables
dataVizExt.clearHighlightedViewables();