Dialog edit custom template

Hi 

How to do custom template for dialog edit in blazor gantt.
I couldn't see any documentation or demos.

can you help

3 Replies 1 reply marked as answer

LG Logeswari Gopalakrishnan Syncfusion Team July 16, 2020 02:30 PM UTC

Hi Cemil, 
We can achieve your requirement, by using OnToolbarClick event. By using OnToolbarClick event, we can cancel the default add dialog by setting args.Cancel as true and  can render custom dialog by using Show method of dialog control. Please find the below code example.  
[Index.razor] 
 
// Render Dialog 
<SfDialog ID="DialogContainer" @ref="Dialog" Width="700px" IsModal="true" Header="Add Custom Dialog" @bind-Visible="@IsVisible"> 
        <DialogTemplates> 
            <Content> 
                This is Custom dialog. 
            </Content> 
        </DialogTemplates> 
        <DialogButtons> 
            <DialogButton Content="Cancel" OnClick="@CloseDialog" /> 
        </DialogButtons> 
        <DialogAnimationSettings Effect="DialogEffect.None"/> 
    </SfDialog> 
 
// Render Gantt 
    <SfGantt ID="GanttContainer" @ref="Gantt" DataSource="@TaskCollection"  
…….///// 
        <GanttEvents OnToolbarClick="onToolbarClick" TValue="TaskData"></GanttEvents> 
    </SfGantt> 
 
private bool IsVisible { get; set; } = false; 
 
// Triggers on toolbar click actions 
    public void onToolbarClick(ClickEventArgs args) 
    { 
        if (args.Item.Text == "Add" || args.Item.Text == "Edit") 
        { 
            args.Cancel = true; // Cancel the default dialog 
        } 
        RenderDialog(); 
    } 
 
    public void RenderDialog() 
    { 
        this.Dialog.Show(); // Render custom dialog 
    } 
 
    private void CloseDialog() 
    { 
        this.Dialog.Hide(); // Hide custom dialog 
    } 
 
We have prepared sample for this. Please find the below sample link. 
Please let us know if you need further details on this. 
Regards, 
Logeswari G 



UN Unknown Syncfusion Team July 20, 2020 08:22 AM UTC

Thanks for answer

When I use custom dialog with toolbar button that is work

But dbclick on row works yet.
 I couldn't find any event like OndbClick or allowDbClick attr 

how can I do dbl click to task and open custom dialog


regards
Cemil



LG Logeswari Gopalakrishnan Syncfusion Team July 21, 2020 10:36 AM UTC

Hi Cemil, 
We have analyzed query and OnActionBegin event will trigger while double click action on row. We can render custom dialog on double click action using OnActionBegin event with RequestType beforeOpenEditDialog. In the previous update, we suggested onToolbarClick event for toolbar click action. But we can use OnActionBegin event also for toolbar click action. No need to use both events. Please find the below code snippet. 
    <SfGantt ID="GanttContainer" @ref="Gantt" DataSource="@TaskCollection" Height="450px"  
…//// 
        <GanttEvents  OnActionBegin="OnActionBegin" TValue="TaskData"></GanttEvents> 
    </SfGantt> 
 
@code{ 
    public void OnActionBegin(ActionBeginArgs<TaskData> args) 
    { 
        if (args.RequestType == "beforeOpenEditDialog") 
        { 
            args.Cancel = true; 
            RenderDialog(); 
        } 
    } 
} 
 
We have prepared sample for this. Please find it from below sample link. 
Please let us know, if you need further details on this. 
Regards, 
Logeswari G 


Marked as answer
Loader.
Up arrow icon