Example of Tooltip Template in ASP.NET MVC Kanban Control
This sample demonstrates tooltip customization in the Kanban component, enabling additional card information to be presented through rich and interactive tooltip content.
Assignee: ${Assignee} | Type: ${Type} | Estimate: ${Estimate} | Summary: ${Summary}
Properties
<template id="kanban-tooltip-template">Assignee: ${Assignee} | Type: ${Type} | Estimate: ${Estimate} | Summary: ${Summary}</template>
@Html.UiKanban(new UiKanbanOptions
{
Id = "tooltipTemplateBoard",
DataSource = (IEnumerable<object>)ViewData["DataSource"],
KeyField = "Status",
CardSettings = new UiKanbanCardSettings { HeaderField = "Id", ContentField = "Summary", TagsField = "Tags", GrabberField = "Cls" },
Columns = new List<UiKanbanColumn>
{
new UiKanbanColumn { KeyField = "Open", HeaderText = "To Do" },
new UiKanbanColumn { KeyField = "InProgress", HeaderText = "In Progress" },
new UiKanbanColumn { KeyField = "Testing, Validate", HeaderText = "In Review" },
new UiKanbanColumn { KeyField = "Close", HeaderText = "Done" }
},
SwimlaneSettings = new UiKanbanSwimlaneSettings { KeyField = "Assignee" },
EnableTooltip = true,
TooltipTemplateId = "kanban-tooltip-template",
Height = "auto",
AriaLabel = "Task board"
})
<div class="demo-property-panel">
<h3>Properties</h3>
<div class="demo-property-row"><label for="enableTooltip">Enable Tooltip</label><input id="enableTooltip" type="checkbox" checked /></div>
<div class="demo-property-row"><label for="enableTooltipTemplate">Enable Tooltip Template</label><input id="enableTooltipTemplate" type="checkbox" checked /></div>
</div>
<script>
(function () {
var board = function () { return window.Lumen.get('tooltipTemplateBoard'); };
function change() {
board().setTooltipSettings({
enable: document.getElementById('enableTooltip').checked,
templateId: document.getElementById('enableTooltipTemplate').checked ? 'kanban-tooltip-template' : null
});
}
document.getElementById('enableTooltip').addEventListener('change', change);
document.getElementById('enableTooltipTemplate').addEventListener('change', change);
}());
</script>
<template id="kanban-tooltip-template">Assignee: ${Assignee} | Type: ${Type} | Estimate: ${Estimate} | Summary: ${Summary}</template>
<style>
.ui-kanban-card-grabber.sf-low { background: #7ed321; }
.ui-kanban-card-grabber.sf-normal { background: #f5c518; }
.ui-kanban-card-grabber.sf-critical { background: #9c27b0; }
.ui-kanban-card-grabber.sf-breaker { background: #e53935; }
</style>
@Html.UiKanban(new UiKanbanOptions
{
Id = "tooltipTemplateBoard",
DataSource = (IEnumerable<object>)ViewData["DataSource"],
KeyField = "Status",
CardSettings = new UiKanbanCardSettings { HeaderField = "Id", ContentField = "Summary", TagsField = "Tags", GrabberField = "Cls" },
Columns = new List<UiKanbanColumn>
{
new UiKanbanColumn { KeyField = "Open", HeaderText = "To Do" },
new UiKanbanColumn { KeyField = "InProgress", HeaderText = "In Progress" },
new UiKanbanColumn { KeyField = "Testing, Validate", HeaderText = "In Review" },
new UiKanbanColumn { KeyField = "Close", HeaderText = "Done" }
},
SwimlaneSettings = new UiKanbanSwimlaneSettings { KeyField = "Assignee" },
EnableTooltip = true,
TooltipTemplateId = "kanban-tooltip-template",
Height = "auto",
AriaLabel = "Task board"
})
<div class="demo-property-panel">
<h3>Properties</h3>
<div class="demo-property-row"><label for="enableTooltip">Enable Tooltip</label><input id="enableTooltip" type="checkbox" checked /></div>
<div class="demo-property-row"><label for="enableTooltipTemplate">Enable Tooltip Template</label><input id="enableTooltipTemplate" type="checkbox" checked /></div>
</div>
<script>
(function () {
var board = function () { return window.Lumen.get('tooltipTemplateBoard'); };
function change() {
board().setTooltipSettings({
enable: document.getElementById('enableTooltip').checked,
templateId: document.getElementById('enableTooltipTemplate').checked ? 'kanban-tooltip-template' : null
});
}
document.getElementById('enableTooltip').addEventListener('change', change);
document.getElementById('enableTooltipTemplate').addEventListener('change', change);
}());
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class KanbanController : Controller
{
// The page is Views/Kanban/TooltipTemplate.cshtml; it draws what ViewData holds.
public ActionResult TooltipTemplate()
{
ViewData["DataSource"] = OverviewCards();
return View();
}
private const string Open = "Open";
private const string InProgress = "InProgress";
/// <summary>Syncfusion's Overview data: tasks by assignee, a priority (its colour), and up to two tags.</summary>
private static List<object> OverviewCards()
{
// Syncfusion's Overview data: tasks by assignee, a priority (its colour), and up to two tags.
string[][] rows =
{
new[] { "Task - 29033", "Open", "Arrange web meeting with customer to get editing requirements.", "sf-breaker", "Story", "Improvement", "Andrew Fuller" },
new[] { "Task - 29002", "InProgress", "Add responsive support to applicaton.", "sf-normal", "Story", "Kanban", "Andrew Fuller" },
new[] { "Task - 29004", "InProgress", "Fix the issues reported in the IE browser.", "sf-critical", "Bug", "Customer", "Andrew Fuller" },
new[] { "Task - 29016", "Testing", "Fix the issues reported in IE browser.", "sf-critical", "Bug", "Customer", "Andrew Fuller" },
new[] { "Task - 29018", "Close", "Arrange web meeting with customer to get login page requirement.", "sf-critical", "Feature", "", "Andrew Fuller" },
new[] { "Task - 29025", "Close", "Add input validation for editing.", "sf-breaker", "Bug", "Breaking Issue", "Andrew Fuller" },
new[] { "Task - 29003", "Open", "Show the retrived data from the server in grid control.", "sf-breaker", "Bug", "Breaking Issue", "Janet Leverling" },
new[] { "Task - 29030", "InProgress", "Test editing functionality.", "sf-normal", "Story", "", "Janet Leverling" },
new[] { "Task - 29017", "Testing", "Enhance editing functionality.", "sf-low", "Story", "Kanban", "Janet Leverling" },
new[] { "Task - 29022", "Close", "Analyze stored procedure.", "sf-breaker", "CustomSample", "", "Janet Leverling" },
new[] { "Task - 29031", "Open", "Fix the issues reported by the customer.", "sf-normal", "Bug", "Customer", "Janet Leverling" },
new[] { "Task - 29019", "Validate", "Validate the new requirements.", "sf-low", "Story", "", "Janet Leverling" }
};
return rows.Select(r => (object)new Dictionary<string, object>
{
{ "Id", r[0] }, { "Status", r[1] }, { "Summary", r[2] }, { "Cls", r[3] }, { "Tag1", r[4] }, { "Tag2", r[5] },
{ "Tags", string.Join(",", new[] { r[4], r[5] }.Where(t => t.Length > 0)) }, { "Type", r[4] }, { "Estimate", (Array.IndexOf(rows, r) % 5 + 1) * 0.5 },
{ "Assignee", r[6] }, { "Initials", string.Concat(r[6].Split(' ').Select(w => w.Substring(0, 1))) }
}).ToList();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
This sample demonstrates the tooltip functionality of the Kanban component using the EnableTooltip and TooltipTemplate properties. Tooltips provide additional contextual information about cards when users hover over them.
EnableTooltip: If you set this property totrue, the cards show a tooltip with the default format.TooltipTemplate: If you setEnableTooltiptotrueand configure theTooltipTemplate, the cards show a tooltip with templated content (theAssignee,Type,EstimateandSummaryfields in this demo).