We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How can I create a custom taskbar template like tooltip template.

Hi,

I am trying to use taskbar template to display task resource pictures within taskbar.
According to the demo I can only use some static url for images.
I want to use different url's for different users.
Ex:
 resoure 1: 
image url : ..\images\users\xxxx.jpg
resource 2:
url: ..\images\users\contractors\yyyyy.jpg

.....
instead of using the standard way described in demo like below: 
<script type="text/x-jsrender" id="taskbarTemplate">
    <div class="e-gantt-template-taskbar bg-color" style="border-radius:5px;overflow:hidden;-webkit-transform:translateZ(0);-webkit-mask-image: -webkit-radial-gradient(circle, white, black);">
        <div>
            {{if #data['resourceNames']}}
            <img style="position:relative;top:8px;left:4px;text-align:left;z-index:1;" height="32" width="32" src="../images/gantt/{{:#data['resourceNames']}}.png" />
I want to use as described in 
https://www.syncfusion.com/kb/2723/how-to-create-a-custom-tooltip-template-in-gantt
 @(Html.EJ().Gantt("gantt")
        // ...
       .TaskbarTooltipTempate(“<table><tbody><tr><td>BuildStage :</td><td>{{:~_stageName()}}</td> </tr></tbody></table>”)
      // ...
        )   
<script type=”text/javascript”>
$.views.helpers({_stageName: getStageName });   
    &a

3 Replies

JS Jonesherine Stephen Syncfusion Team December 5, 2016 11:55 AM UTC

Hi Renu, 
Thanks for contacting Syncfusion support. 
We can refer different image path while rendering custom taskbar template. 
We have prepared the work around and provided the required image path in a separate field and referred that path in taskbar template. 
Please find the code example below: 
[view]     
@(Html.EJ().Gantt("GanttContainer"). 
       .TaskbarTemplate("#taskbarTemplate") 
       .ParentTaskbarTemplate("#parentTaskbarTemplate") 
       .MilestoneTemplate("#milestoneTemplate") 
    ) 
    @(Html.EJ().ScriptManager()) 
    <script type="text/x-jsrender" id="taskbarTemplate"> 
                {{if #data['resourceNames']}} 
                <img style="position:relative;top:8px;left:4px;text-align:left;z-index:1;" height="32" width="32" src={{:#data.item.ImagePath}}/> 
                                 //… 
    </script> 
     
[controller] 
            tasks[0].SubTasks[0].SubTasks.Add(new TaskDetails() 
            { 
                 // 
                ResourceID = new List<object>() { 1 }, 
                ImagePath = "Content/gantt/folder1/Robert King.png" 
               
 
            }); 
We have also prepared the sample based on this, please find the sample from below location 
Disclaimer: We have removed bin and obj folder in the given sample for some security reasons, we must include Syncfusion.EJ, Syncfusion.EJ.MVC, dlls to render the Gantt control which is available in Essential Studio installed location.   
Regards, 
Jone sherine P S 



RE Renu December 5, 2016 04:50 PM UTC

Hi Jone sherine,

That's what I am looking for.
Thank you.

Regards,
Renu



JS Jonesherine Stephen Syncfusion Team December 6, 2016 04:57 AM UTC

Hi Renu, 
Thanks for your update 
Please let us know if you need further assistance on this, 
Regards, 
Jone sherine P S 


Loader.
Live Chat Icon For mobile
Up arrow icon