bewe
bewe

Reputation: 49

Apex. How to refresh the URL of Display Image item?

I cannot find any documentation.

I have a Display Image item in Apex. It is configured to take the URL from "Image URL stored in Page Item Value"

The URL is loaded from a table with a SQL query.

But I need to change the URL, and display the new image.

I change the URL with a "Set Value" dynamic event fired from another item, but it does not changes anything on the Display Image item.

I checked that the Set Value items works when updating a display only item, but the exact same procedure does not works with the Display Image item.

I also tried to fire a "refresh" dynamic event, but it does nothing.

I'm going crazy trying to find the documentation, but it is shallow, and does not gives any clue.

Upvotes: 1

Views: 1945

Answers (1)

bewe
bewe

Reputation: 49

I found a way. Instead of a "Set value" Dynamic action, it should be a "Execute JavaScript Code" Dynamic action, with this code:

    $("#DISPLAY_IMAGE_ITEM").attr('src','https://someURL');

Note: if the URL is taken from an Item value, it should be assured that the item has escape characters disabled.

Upvotes: 1

Related Questions