SFGrid-Continuous Adding of Records In Dialog Mode

Hi!
I am very new to Blazor and C#. I am working on a trial project. I have setup a blazor component with SFGrid. The feature I am looking for is as below

Click on add button on the toolbar of the grid.
The Dialog for data entry pops up.
The user enters the necessary fields and clicks on the Save button. The dialog closes and the record is saved

My question is whether I can stop the dialog being closed on click of Save button. It should save the record and should move to the first field in dialog, waiting for the next record entry. Otherwise the user has to click the Add button again, which will slow down the data entry.

Is there a way to achieve this.

Regards
Prasad

4 Replies 1 reply marked as answer

PR Prasad September 21, 2020 08:00 AM UTC

Any thoughts on this question.. Please..


RN Rahul Narayanasamy Syncfusion Team September 21, 2020 12:23 PM UTC

Hi Prasad, 

Greetings from Syncfusion. 

Query: SFGrid-Continuous Adding of Records In Dialog Mode - Otherwise the user has to click the Add button again, which will slow down the data entry. 

We have validated your query and you want to keep the dialog open for subsequent addition of records. Here, we have prepared a sample based on your requirement using FooterTemplate property of EditSettings. By default while saving the record, the dialog will be close. Based on your requirement, we have reopened the dialog for adding the next record using AddRecord method of the Grid. So the dialog will be shown after saving the record. Find the below code snippets and sample for your reference. 

 
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" Height="315"> 
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog"> 
        <FooterTemplate> 
            <SfButton CssClass="btn btn-primary" OnClick="Save" IsPrimary="true">Save</SfButton> 
            <SfButton OnClick="Cancel">Cancel</SfButton> 
        </FooterTemplate> 
    </GridEditSettings> 
    <GridColumns> 
        . . . 
   </GridColumns> 
</SfGrid> 
 
@code{ 
    SfGrid<Order> Grid; 
    . . . 
   protected async Task Save() 
    { 
        await Grid.EndEdit(); 
        await Grid.AddRecord(); 
    } 
    protected async Task Cancel() 
    { 
        await Grid.CloseEdit(); 
    } 
} 


Please let us know if you have any concerns. 

Regards, 
Rahul 
 


Marked as answer

PR Prasad September 23, 2020 04:37 PM UTC

The solution provided worked well. 
Thank you for the support!


RN Rahul Narayanasamy Syncfusion Team September 24, 2020 04:35 AM UTC

Hi Prasad, 
 
Thanks for the update. 
 
We are happy to hear that the provided solution was helpful to achieve your requirement. 
 
Please get back to us if you need further assistance. 
 
Regards, 
Rahul 


Loader.
Up arrow icon