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

Conditionally adding dialog buttons doesn't work properly

In the buttons added later events are not raised. Buttons are not removed. Example:

@page "/dialog01"
@using Syncfusion.EJ2.Blazor.Popups
@using Syncfusion.EJ2.Blazor.Buttons

<EjsButton @onclick="@OnBtnClick">Open Dialog</EjsButton>
<EjsDialog Width="320px" @bind-Visible="@DialogVisible" ShowCloseIcon="true" IsModal="true">
    <DialogTemplates>
        <Header> Update Required!!! </Header>
        <Content> Would you like to install the latest updates? </Content>
    </DialogTemplates>
    <DialogButtons>
        @if (altVisible)
        {
            <DialogButton ButtonModel="@DialogBtn" OnClick="@OnClicked"></DialogButton>
        }
        else
        {
            <DialogButton ButtonModel="@DialogNoBtn" OnClick="@OnClicked"></DialogButton>
        }
    </DialogButtons>
</EjsDialog>


@code {
    public bool altVisible = false;
    public bool DialogVisible { get; set; } = false;
    public ButtonModel DialogBtn = new ButtonModel
    {
        Content = "Update",
        IsPrimary = true
    };
    public ButtonModel DialogNoBtn = new ButtonModel
    {
        Content = "Later",

    };

    private void OnBtnClick()
    {
        altVisible = !altVisible;
        this.DialogVisible = true;
    }
    private void OnClicked()
    {
        DialogVisible = false;
    }
}



As a side note, not related to the previous problem, the dialog html is not removed from the DOM when the Component is disposed. After showing many dialogs the number of elements in the body keep increasing. Is the control in preview that has so many bugs?

5 Replies

IS Indrajith Srinivasan Syncfusion Team January 6, 2020 12:44 PM UTC

Hi Rodolfo, 
  
Currently, we validating the reported issue, will update further details shortly.

 
Regards, 
Indrajith 



IS Indrajith Srinivasan Syncfusion Team January 6, 2020 05:09 PM UTC

Hi Rodolfo, 
 
Greetings from Syncfusion support 
 
Query 1: Conditionally adding dialog buttons doesn't work properly 
 
We have validated the reported scenario. The previously rendered buttons are maintained when rendering it based on conditional approach. As well as few dialog elements are still persist after the component is disposed. We consider both issues as bug in our end. We will include the fix in weekly patch release which is planned to roll-out on 14th January. 
 
You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link: 
 
 
Until then, we suggest you to use the below workaround solution to render the dialog buttons using the FooterTemplate and DialogButtons as follows. 
 
 
 
Query 2: Is the control in preview that has so many bugs? 
 
The component moved from preview to final in last 2019 Volume 4 release.  
 
Regards, 
Indrajith 



PM Pandiyaraj Muniyandi Syncfusion Team January 17, 2020 05:23 AM UTC

Hi Rodolfo, 
 
Sorry for the inconvenience caused. 
 
We could not include the fix with our last weekly patch release due to complexity on resolving the reported issue from our end. We will resolve and include the fix in our 2019 Volume 4 SP1 release, which is expected to roll-out on end of January. 
 
Regards, 
Pandiyaraj 



IS Indrajith Srinivasan Syncfusion Team January 31, 2020 05:29 PM UTC

Hi Rodolfo, 
 
We are glad to announce that our Essential Studio Volume 4, 2019 service pack release (v17.4.0.46) is rolled out and is available for download under the following link. And the fix for Dynamic render of dialog buttonsis included. We could not include the fix for “Dialog html is not removed from the DOM when the Component is disposed” with our Volume 4 SP 1 release due to complexity on resolving the reported issue from our end. We will resolve and include the fix in our upcoming patch release scheduled to roll-out on 5th February 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Indrajith 



IS Indrajith Srinivasan Syncfusion Team February 5, 2020 06:45 PM UTC

Hi Rodolfo, 
 
Thanks for your patience, 
 
We have resolved the issue with “Dialog html is not removed from the DOM when the Component is disposed” and the fix is now available with the patch release version 17.4.47. Could you please upgrade your package to this version to resolve the issue from your end. 
 
Regards, 
Indrajith 


Loader.
Live Chat Icon For mobile
Up arrow icon