Update Row Index Details is not working

await GridDetail.UpdateCell(RowIndexDetail, "LotNoId", _lotnoid); is not working

POS.PNG


Attachment: ADEditBase_6d41d256.rar

7 Replies

BP Belle Perez August 10, 2022 05:18 AM UTC

sample.PNG

After clicking the save button it will automatically display grid details.

Like this:

LotNo.png

Not this:

LotNo.PNG



MS Monisha Saravanan Syncfusion Team August 11, 2022 01:50 PM UTC

Hi Belle,


Greetings from Syncfusion support.


We have analyzed your query and we suspect that you are using UpdateCell method with dialog mode of edit. If So we would like to inform that UpdateCell method will work only in Batch mode of edit. Instead of using UpdateCell method we suggest you to use UpdateRowAsync method to update the edited data to the DataGrid. Kindly check the attached code snippet for your reference.


 

<SfGrid DataSource="@Orders" @ref="Grid" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">

</SfGrid>

 

@code{

    public List<Order> Orders { get; set; }

    public SfGrid<Order> Grid;

 

   private async Task OKCloseDialog()

    {

        SelectedProduct.Remarks = TextBoxRef.Value;

        await this.Grid.UpdateRowAsync(selectedIndex, SelectedProduct);  // update the row using method

        this.IsVisible = false;

    }   

}


Also we would like to inform the you can use Action events of Grid to modify the data. It will trigger for every CRUD operation. By using request type of action event you can find and perform your own action.


Reference: https://blazor.syncfusion.com/documentation/datagrid/events#onactionbegin

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_UpdateRowAsync_System_Double__0_

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_SetRowDataAsync_System_Object__0_


Kindly get back to us if you have further queries.


Regards,

Monisha


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.




BP Belle Perez August 12, 2022 07:08 AM UTC

 protected async Task ConfirmLotNoAdd_Click(int _lotnoID) //August 8, 2022

        {

            if (_lotnoID != 0)

            {

                await Task.Delay(200);


                LotNumbers = (await LotNumberService.GetLotNumbers()).ToList(); //Fetch the selected records


                await GridDetail.UpdateCell(RowIndexDetail, "LotNoId", _lotnoID);


                StateHasChanged();

            }


        }


It gives me this result: 

LotNo.PNG

I want to display in the data grid the latest added LotNo which is "sample1": 

LotNo.png



BP Belle Perez August 12, 2022 07:14 AM UTC

This is the Razor


Attachment: ADEdit_b0242e3e.rar


BP Belle Perez August 12, 2022 07:14 AM UTC

This is the EditBase


Attachment: ADEditBase_d9f7de8d.rar


BP Belle Perez August 12, 2022 08:20 AM UTC

I am currently using the Batch mode. 

  1. How to get the value of Lot no in the data grid after saving?
  2. We use the component or customize add button to save the new lot no.


MS Monisha Saravanan Syncfusion Team August 15, 2022 12:51 PM UTC

Hi Belle,


Thanks for the update.


We have checked your query and we suspect that the LotNo column is an integer column and you are trying to save an string value while adding new columns. If so we suggest you to use column template feature of DataGrid for display purpose. You can store the entered value in the local variable and you can use them inside the column template. Also we could see that in your shared method(ConfirmLotNoAdd_Click) you have passed  integer value as an argument and it is used inside the update cell method. Also we suggest you to use value change event for the LotNo column while adding so that it triggers when the value is changed and we can get the corresponding changed value in the event args.


Reference: https://blazor.syncfusion.com/documentation/datagrid/column-template


If the reported issue still persist then kindly share the below details to validate further at our end.


  1. Share us model class and code behind the LotNoAdd.razor
  2. If possible share us an simple issue reproduceable sample.
  3. If you suspect that we misunderstood your query then kindly share us the video demo explaining the issue.

The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Monisha



Loader.
Up arrow icon