Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kb(grid,tooltip):tooltip in grid example changes (#141)
* kb(grid,tooltip):tooltip in grid example changes * kb(tooltip):fixes as per comment * Update tooltip/in-grid/Pages/Index.razor Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com> * Update tooltip/in-grid/Pages/Index.razor Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com> Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com>
- Loading branch information
1 parent
cbc9a71
commit a0433ab
Showing
5 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@page "/tooltip-per-cell" | ||
|
||
@using TooltipForGridElements.Models | ||
@using TooltipForGridElements.Services | ||
|
||
@inject EmployeeService EmployeeService | ||
|
||
<p> | ||
This example shows how to load content on demand for tooltips that target elements inside a grid. | ||
The difference from the first page is that the example here uses an instance for every cell. | ||
</p> | ||
<p> | ||
The tooltip per cell approach offers a lot of extra flexibility if needed. | ||
</p> | ||
|
||
<TelerikGrid Data="@GridData" Height="400px" | ||
Pageable="true" Sortable="true" Groupable="true" | ||
FilterMode="Telerik.Blazor.GridFilterMode.FilterRow" | ||
Resizable="true" Reorderable="true"> | ||
<GridColumns> | ||
<GridColumn Field="@(nameof(BasicEmployee.Id))" Width="120px" /> | ||
<GridColumn Field="@(nameof(BasicEmployee.Name))" Title="Employee Name" Groupable="false"> | ||
<Template> | ||
@{ | ||
BasicEmployee employee = context as BasicEmployee; | ||
<span data-employeeId="@employee.Id" id="@( "tooltip-target" + employee.Id)">@employee.Name</span> | ||
<TelerikTooltip TargetSelector="@( "#tooltip-target" + employee.Id)" | ||
Width="350px" Height="250px" Position="@TooltipPosition.Right"> | ||
<Template Context="ttipContext"> | ||
<EmployeeDetails TargetData="@ttipContext.DataAttributes" /> | ||
</Template> | ||
</TelerikTooltip> | ||
} | ||
</Template> | ||
</GridColumn> | ||
<GridColumn Field="@(nameof(BasicEmployee.Team))" Title="Team" /> | ||
</GridColumns> | ||
</TelerikGrid> | ||
|
||
|
||
|
||
@code { | ||
public List<BasicEmployee> GridData { get; set; } | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
GridData = await EmployeeService.GetEmployees(); | ||
// we update the data outside of the standard cycle, so we need this call | ||
// if we did it in OnInitializedAsync we wouldn't. We do it here to load it only once | ||
// and avoid loading during pre-rendering, just as an example | ||
StateHasChanged(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters