Our monthly Virtual Happy Hour is happening this week, Fri Feb 23!

Try our conversational search powered by Generative AI!

How to get image name using id in dojo

Vote:
 

Hi All, 

I am new to episerver CMS. I am creating a custom widget using dojo for repetable image selector (Text box with a browse button to Media). I need to get the image name from dojo using the image id. Can anyone help me?

#141955
Nov 25, 2015 11:10
Vote:
 

You can use the Dojo object stores that Episerver provides as JS APIs.

Here is the article from the CMS UI documentation that describes the stores:

http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/9/User-interface/Store-architecture/

You would be using the epi.cms.contentdata store to retrieve data on the image using it's content reference (assuming that is what you are referring to when you say image id).

It should look something similar to this:

var registry = dependency.resolve("epi.shell.store.Registry"),
    store = registry.get("epi.cms.contentdata"),
    query = store.query({
        id: 3,
        language: "en"
    });
 
query.observe(dojo.hitch(this, this.onChange));
query.then(function(results) {
    this.view.data = results;
});
#142081
Edited, Nov 30, 2015 16:42
Vote:
 

Hi Matthew,

I will look in to it. Hope it will be very helpful for me.

Thank you.

#142113
Edited, Dec 01, 2015 8:16
Vote:
 
#142771
Dec 22, 2015 16:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.