Data transfer Sparkline Tooltip Template

1 Answer 71 Views
Chart Gantt ToolTip TreeView
Dima
Top achievements
Rank 1
Dima asked on 18 Aug 2021, 07:19 AM
 The item data is not transferred via the hash syntax to the custom template ("tooltip-tamplate") for the tooltip. But it works for other templates "task-templat" and "column-template". Please help me to find out the solution. Below is my code in View:

            <!--Style progress bar-->
            <script id="task-template" type="text/x-kendo-template">
                <div class="template" style="background-color: #= Color #;">
                    <a href="#= Link #">
                        <h5 style="font-family: "Open Sans",sans-serif;">#= title #<\h5>
                    </a>
                </div>
            </script>

            <!--Style columns-->
            <script id="column-template" type="text/x-kendo-template">
                @*<i class="tio-bookmark-outlined tio-lg text-primary"></i>*@
                <span>#= ProjectGenre #</span>
            </script>

            <!--Style ToolTip-->
            <script id="tooltip-tamplate" type="text/x-kendo-template">
                <div style="padding: 1rem;">
                    <p>Genre: #= ProjectGenre # </p>
                </div>
            </script>

@(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>((IEnumerable<TaskViewModel>)ViewData["tasks"], (IEnumerable<DependencyViewModel>)ViewData["dependencies"])
                            .Name("gantt")
                            .Columns(columns =>
                            {
                                columns.Bound(c => c.Studio).Title("Студія").Width(200).Sortable(true);
                                columns.Bound(c => c.ProjectGenre).Title("Жанр").Width(300).Sortable(true).TemplateId("column-template");
                            })
                            .Views(views =>
                            {
                                views.YearView(yearView => yearView.Selected(true));
                            })
                            .ShowWorkHours(false)
                            .ShowWorkDays(false)
                            .Editable(false)
                            .Height(600)
                            .TaskTemplateId("task-template")
                            .DataSource(d => d
                                .Model(m =>
                                {
                                    m.Id(f => f.TaskID);
                                    m.ParentId(f => f.ParentID);
                                    m.Field(f => f.Expanded).DefaultValue(true);
                                    m.Field(f => f.Start).ToString();
                                    m.Field(f => f.End).ToString();
                                })
                            )
                            .Tooltip(t =>
                            {
                                t.Visible(true);
                                t.TemplateId("tooltip-tamplate");
                            })
                            .DependenciesDataSource(d => d
                                .Model(m =>
                                {
                                    m.Id(f => f.DependencyID);
                                    m.PredecessorId(f => f.PredecessorID);
                                    m.SuccessorId(f => f.SuccessorID);
                                })
                            )
                    )

1 Answer, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 20 Aug 2021, 02:08 PM

Hello Dima,

The complete task is part of the data object passed to the tooltip template. Therefore you can do the following:

<!--Style ToolTip-->
            <script id="tooltip-tamplate" type="text/x-kendo-template">
                <div style="padding: 1rem;">
                   #console.log(data)# // add this line, hover over a task and the data passed to the template will be logged in case you need further details
                    <p>Genre: #= task.ProjectGenre # </p>
                </div>
            </script>

Let me know if the above resolves the issue.

Regards,
Aleksandar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Chart Gantt ToolTip TreeView
Asked by
Dima
Top achievements
Rank 1
Answers by
Aleksandar
Telerik team
Share this question
or