Refresh grid after adding item to grid

Hi,
Is there a way to refresh the grid after saving a new item when using the server-side UrlAdaptor?
Currently I have to refresh the browser to see the new added item.

Thanks,

3 Replies

MS Mani Sankar Durai Syncfusion Team October 23, 2017 10:49 AM UTC

Hi Mahindra, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want to visualize the added record in grid. Based on this we have already documented a Syncfusion Knowledge base and the same can be available from the below link. 

If you still face the issue please get back to us with the following details. 
1.       Share the screenshot video of the issue that you have faced? 
2.       In what case you have faced a new? 
3.       Share the grid code that you have used in your application 
4.       If possible please reproduce the issue in the simple sample and provide us. 

The provided information will help us to analyze the issue and provide you the response as early as possible. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 




MM Mahindra Morar October 27, 2017 09:24 PM UTC

Hi Manisankar,

Unfortunately I am still having issues with the new added item not being shown in the grid after saving . Note that I am using ASP.Net Core.

Below is the code for the View:

<div id="ControlRegion">

    <ej-dialog id="ErrorList" title="Error" show-on-init="false" close="onDialogClose"></ej-dialog>

    <ej-grid id="FlatGrid" allow-sorting="true"  action-failure="OnActionFailure" action-complete="OnActionComplete">       

        <e-datamanager url="Pricing/Currency/GetList"  update-url="Pricing/Currency/Update" insert-url="Pricing/Currency/Insert" adaptor="@AdaptorType.UrlAdaptor"></e-datamanager>      

        <e-edit-settings allow-adding="true" allow-editing="true" allow-deleting="true"></e-edit-settings>

        <e-toolbar-settings show-toolbar="true" toolbar-items='@new List<string> {"add","edit","update","delete","cancel"}' />

        <e-columns>

            <e-column field="CurrencyID" header-text="ID" is-primary-key ="true" is-identity="true"></e-column>

            <e-column field="Code" header-text="Code"></e-column>

            <e-column field="Symbol" header-text="Symbol"></e-column>

            <e-column field="Prefix" header-text="Prefix"></e-column>

            <e-column field="GroupSize" header-text="Group Size" edit-type="Numeric"></e-column>

            <e-column field="GroupSeparator" header-text="Group Separator" />

            <e-column field="DecimalSeparator" header-text="Decimal Separator" />

            <e-column field="ShortName" header-text="Short Name"></e-column>

            <e-column field="LongName" header-text="Long Name" ></e-column>

            <e-column field="Country" header-text="Country" ></e-column>

            <e-column field="IsActive" header-text="Active" edit-type"="Boolean" ></e-column>

            <e-column field="Lockstamp" header-text="Lockstamp" visible="false"  ></e-column>                            

        </e-columns>        

    </ej-grid>  

</div>

Here is the C# code 

  public async Task<ActionResult> Insert([FromBody]CRUDModel<mdCurrency> value)

        {

            var crudMsg = new mdCrudMessage();

            if (value.Action == Constants.CrudOperations.LIT_INSERT)

            {

                var response = await PostWSObjectAsync<mdCurrency, mdCurrencyResponse>(value.Value, URI_RESOURCE);

                crudMsg = MessageFormatter.FormatCrudResultsHtml(response.CrudResults);

            }

            if (crudMsg.IsFault)

                return new BadRequestObjectResult(crudMsg.HtmMessage);

            return Json(value.Value);            

        }

The only way I can view the newly inserted row is to resfresh the page by pressing F5, which I want to avoid.

Thanks for your help.



MS Mani Sankar Durai Syncfusion Team October 30, 2017 10:58 AM UTC

Hi Mahindra, 

We have checked your query and based on your code example we have prepared a sample with is-identity column and that can be available from the below link. 

Refer the code example 
public ActionResult NormalInsert([FromBody]CRUDModel<Orders> param) 
        { 
           _context.Orders.Add(param.Value);   //record to be added in DB 
            _context.SaveChanges(); 
            var data = _context.Orders.ToList(); 
            return Json(param.Value);     //return the added records 
        } 

If you still face the issue please get back to us with the following details. 
1.       Share the video of the issue that you have faced. 
2.       Share the full controller page. 
3.       Share the post details from the network tab. 
4.       If possible please reproduce the issue in the above attached sample. 
The provided information will help us to analyze the issue and provide you the response as early as possible. 
 
Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 



Loader.
Up arrow icon