We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Dialog closing stop to work when calling Javascript

Hi!

I found a strange behavior with the latest packages (.Net Core 3.0 preview 8, Syncfusion.EJs.Blazor 17.2.0.47.Beta) with the dialog component.

I attached the sample that reproduce the issue. Just run it. If you click on the Open Dialog button, it works. Then you can click on Ok or Cancel button and dialog will close.
Now, stop the application. Uncomment the line 30 in Index.razor file

Line 30 : 
// await JSRuntime.InvokeAsync<object>("window.testCallJs.startCallJs");

Then run the app again. Click on the Open Dialog button. The dialog opens. But if you try to close it with Ok or Cancel button, it doesn't work.

If you take a look in the Index.razor file, you will see that I tried to use DialogEvents, but without any success.

This code worked when my application was running under .Net core 3.0 preview 7 and syncfusion 17.2.0.40.

Best regards,
Benoit

Attachment: BlazorApp1_6e6fd58.zip

3 Replies

PM Pandiyaraj Muniyandi Syncfusion Team September 2, 2019 06:39 AM UTC

Hi Benoit, 
 
Greetings from Syncfusion support. 
 
We have validated the reported issue with the shared sample and able to reproduce from our end. The JSRuntime.InvokeAsync method call doesn’t stop without getting a result from the async method call, due to this further action not working in the sample. As per shared sample, startCallJS method not returns any value, so we suggest you change the open dialog button handler return type as void from Task as follows and check from your end. 
 
 
    private async void OnBtnClick() 
    { 
        this.DialogObj.Show(); 
        await JSRuntime.InvokeAsync<object>("window.testCallJs.startCallJs"); 
    } 
 
 
We have modified your sample with above changes, get it from below link 
 
Regards, 
Pandiyaraj M 



BE Benoit September 2, 2019 02:29 PM UTC

Hi Pandiyaraj,

Thanks for your help. It works.

Benoit


PM Pandiyaraj Muniyandi Syncfusion Team September 2, 2019 03:02 PM UTC

Hi Benoit 
 
Most welcome!  
 
Regards,  
Pandiyaraj M 


Loader.
Live Chat Icon For mobile
Up arrow icon