Hello I want to close a TelerikDialog using Esc key and this does not work sometimes. Run this REPL snippet please https://blazorrepl.telerik.com/cnYrwUYq54FZ70xP17. Click into dialog title for instance and press Esc key. Nothing happens.
Very thanks.
Miroslav
Hello,
Please add support for MarkupString in the predefined awaitable dialogs. This will allow us to add new lines and other simple rich content, without the need to resort to the full-blown Dialog component.
Hello,
I am using DialogFactory in a Blazor server app with PreRendering disabled.
It appears to cause more than expected OnParametersSet calls - its firing 2-6 times per page opening. Without DialogFactory it fires only once.
Can I define the Cancel home button by default? When deleting a line I use Confirm Dialogs, I want the default (active) button to be Cancel (not Ok)
---
ADMIN EDIT
Here is a solution you can use:
@inject IJSRuntime _js
@* move this script to a proper place in your project and remove the
suppress-error hack that lets it stay in the component - it is here for brevity only *@
<script suppress-error="BL9992">
function focusCancelDialogButton() {
setTimeout(function() {
var cancelButtons = document.querySelectorAll(".k-dialog .k-dialog-buttongroup .k-button");
if(cancelButtons && cancelButtons.length > 1) {
cancelButtons[1].focus();
}
}, 100);
}
</script>
<TelerikButton OnClick="@ShowConfirm">Show Confirm</TelerikButton>
@code {
[CascadingParameter]
public DialogFactory Dialogs { get; set; }
public async Task ShowConfirm()
{
await _js.InvokeVoidAsync("focusCancelDialogButton");
bool isConfirmed = await Dialogs.ConfirmAsync("Are you sure?");
if (isConfirmed)
{
Console.WriteLine("The user is sure, continue.");
}
else
{
Console.WriteLine("The user changed their mind");
}
}
}
---