mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-02-14 21:32:55 +00:00
Tooltip position updated when forced to change
This commit is contained in:
@@ -44,6 +44,8 @@
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
|
||||
IsJSRuntimeAvailable = true;
|
||||
|
||||
var tooltip = tooltips.LastOrDefault();
|
||||
@@ -85,9 +87,22 @@
|
||||
/// Closes this instance.
|
||||
/// </summary>
|
||||
[JSInvokable("RadzenTooltip.CloseTooltip")]
|
||||
public void CloseTooltip()
|
||||
public async Task CloseTooltip(string position = null)
|
||||
{
|
||||
Service.Close();
|
||||
if (position == null)
|
||||
{
|
||||
Service.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
var tooltip = tooltips.LastOrDefault();
|
||||
|
||||
if (tooltip != null)
|
||||
{
|
||||
tooltip.Options.Position = (TooltipPosition)Enum.Parse(typeof(TooltipPosition), position, true);
|
||||
await InvokeAsync(() => { StateHasChanged(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Close()
|
||||
|
||||
@@ -1155,6 +1155,10 @@ window.Radzen = {
|
||||
if (tooltipContent.classList.contains(tooltipContentClassName)) {
|
||||
tooltipContent.classList.remove(tooltipContentClassName);
|
||||
tooltipContent.classList.add('rz-top-tooltip-content');
|
||||
position = 'top';
|
||||
if (instance && callback) {
|
||||
instance.invokeMethodAsync(callback, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1170,6 +1174,9 @@ window.Radzen = {
|
||||
tooltipContent.classList.remove(tooltipContentClassName);
|
||||
tooltipContent.classList.add('rz-left-tooltip-content');
|
||||
position = 'left';
|
||||
if (instance && callback) {
|
||||
instance.invokeMethodAsync(callback, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user