Gantt refresh or reload

Hi

I Want to reload data to gantt

when taskbar editing it's working
But when update or delete it is not working.

when I refresh gantt it is not reloading data 

How Can I do this 
Note:I Use custom dialog  ==>  thread: 156021

Codes are below

gantt.razor




*********************************************************************************************
customDialog.razor


*************************************************************************
GanttBase.cs





8 Replies 1 reply marked as answer

LG Logeswari Gopalakrishnan Syncfusion Team July 21, 2020 03:33 PM UTC

Hi Cemil, 
In default dialog, we handle click events for ok and cancel button internally in order to save the edited value and cancel the editing action internally. While rendering custom dialog we need to manually update the record using updateRecordById method. In the provided sample we rendered custom dialog with Name field. On change event of ok button, we have updated the record using updateRecordById method. This method will update the values in Db also. So, Gantt can be reloaded with updated records Please find the below code snippet. 
 
[Index.razor] 
 
<SfDialog ID="DialogContainer" @ref="Dialog" Width="700px" IsModal="true" Header="Add Custom Dialog" @bind-Visible="@IsVisible"> 
        <DialogTemplates> 
            <Content> 
                // Render Textbox for ID  
               <SfTextBox ID="InputIdContainer" @ref="InputId" Placeholder="Id" Width="300px" Value="@Id" Enabled="false"></SfTextBox> 
               // Render Textbox for Name 
                <SfTextBox ID="InputNameContainer" @ref="InputName" Placeholder="TaskName" Width="300px" Value="@Name"></SfTextBox> 
            </Content> 
        </DialogTemplates> 
        <DialogButtons> 
            <DialogButton Content="Ok" OnClick="@OkDialog" ></DialogButton> 
            <DialogButton Content="Cancel" OnClick="@CloseDialog" /> 
        </DialogButtons> 
    </SfDialog> 
    <SfGantt ID="GanttExport" @ref="Gantt" TValue="Table" Height="450px" Width="700px" 
             …// 
    </SfGantt> 
 
@code {  
    public string Name { get; set; } 
    public string Id { get; set; } 
    private bool IsVisible { get; set; } = false; 
 
    public void OnActionBegin(ActionBeginArgs<Table> args) 
    { 
        if (args.RequestType == "beforeOpenEditDialog" || args.RequestType == "beforeOpenAddDialog") 
        { 
            args.Cancel = true; 
            RenderDialog(args.RowData.TaskData); //Pass selected data 
        } 
    } 
    public void RenderDialog(Table data) 
    { 
        Id = data.Id.ToString(); // Render Id textbox with id value of selected data 
        Name = data.Name; //Render Name textbox with Name value of selected data 
        this.Dialog.Show(); 
    } 
 
    private void CloseDialog() 
    { 
        this.Dialog.Hide(); 
    } 
 
 
    private void OkDialog() 
    { 
 
        this.Gantt.UpdateRecordByID(new Table() { Id=Convert.ToInt16(this.InputId.Value), Name=this.InputName.Value}); // Update record using method 
        this.Dialog.Hide(); 
    } 
 
    public SfGantt<Table> Gantt; 
    public SfDialog Dialog; 
    public SfTextBox InputName; 
    public SfTextBox InputId; 
} 
 
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

VG Vadim Gerya January 24, 2022 04:11 PM UTC

Hi !

Do we have option to fully refresh Gantt view from datasource based on current datasource state (not only by

UpdateRecordByID).

Assume scenario:

  1. Datasource - ExpandoObject column list (TValue = "ExpandoObject")
  2. Action changes datarecords (ChildDrag, Leftresising, RightResizing, ParentDrag, ProgressResizing, changing Cell etc..)
  3. OnActionComplete I modify Datasource records - and anything can be changed in source List<ExpandoObject>.
  4. I would like to refresh Gantt View and expecting RefreshAsync() to do this but nothing happens. So I get Gantt view not synchronized with original source data..

Does it really only one option exist ? - Find modified records and iterate through by UpdateRecordByID to get data integrity ?



LA Lokesh Arjunan Syncfusion Team January 26, 2022 06:35 AM UTC

Hi 

Thanks for contacting Syncfusion support. 

We are validating the reported query and we will update you further details within two business days(28th  January). 

Until then we appreciate your patience. 

Regards, 
Lokesh 



VG Vadim Gerya replied to Lokesh Arjunan January 31, 2022 09:43 PM UTC

And ... the answer is :)  ? 



AK Alagumeena Kalaiselvan Syncfusion Team February 1, 2022 01:31 PM UTC

Hi Vadim, 

Sorry for the delayed response. 

We have checked your reported case and you can refresh the Gantt based on current DataSource using the args.DataSource of ActionComplete event. Currently we are facing issue with getting updated DataSource in ActionComplete event. So, we have considered this scenario as defect and logged defect report which can be tracked from below link. 

We will fix this issue and included in weekly patch release on  22nd February, 2022. 

Regards 
Alagumeena.K


VG Vadim Gerya replied to Alagumeena Kalaiselvan February 3, 2022 12:49 AM UTC

HI!

OK, Thank you!
Please also note, I have no access to feedback Link you provided. ("This private feedback is not associated with your account " - shown)



AK Alagumeena Kalaiselvan Syncfusion Team February 3, 2022 12:45 PM UTC

Hi Vadim, 

Sorry for the inconvenience. 

We have provided the feedback access to you now. So, please check the feedback link again and get back to us for further assistance. 

Regards 
Alagumeena.K


AK Alagumeena Kalaiselvan Syncfusion Team February 23, 2022 09:39 AM UTC

Hi Vadim, 

We are glad to announce that your reported issue has been fixed and included in package version 19.4.0.53. So, you can upgrade the packages to avail this fix. 

Please let us know for further assistance. 

Regards 
Alagumeena.K 


Loader.
Up arrow icon