Pass Ember components in the data array


#1

Hi Team,
I am using the scheduler to render certain data, I have a scenario where I need to pass a component along with my data, For example, I have an avatar component that has to be appended along with the user name. Please advise on how I can achieve this. I am building this using Ember.


#2

Hello @Chris_Blesson ,

In case if you want to return the ember component from some scheduler templates - currently it’s not supported, and you can return only plain HTML.

In case if you need to display some image, you should pass it to the event’s data, and after that you will be able to return it from the event’s template (or pass the image HTML data to the template in other appropriate way):

scheduler.templates.event_text=function(start, end, event){
    return `${event.text} <img width="60" height="40" src=${event.some_avatar}>`;
}

Here is a demo:
http://snippet.dhtmlx.com/5/020f896aa

Or if you have some predefined avatars, you can create some condition to return avatars based on event’s data(without keeping them in event’s data)


#3

Hi @Siarhei,
Thanks for the workaround, I thought of reusing an existing component that had a lot of functionalities.