We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to update grid data when using Urladaptor

Thread ID:

Created:

Updated:

Platform:

Replies:

141136 Nov 26,2018 11:46 AM UTC Nov 27,2018 12:50 PM UTC ASP.NET Core - EJ 2 3
loading
Tags: DataGrid
Costa
Asked On November 26, 2018 12:03 PM UTC

Hi! I add record to database using Ajax. How do I refresh the grid (used Urladaptor) after that?

In EJ1 I used grid.refreshContent:
..........
                        $.ajax({
                            url: "Admin/Role_Add",
                            type: "POST",
                            beforeSend: function (xhr) {
                                xhr.setRequestHeader("XSRF-TOKEN", $('input:hidden[name="__RequestVerificationToken"]').val());
                            },
                            data: { roleName: inputText }
                        }).done(function (data) {
                            gridRoles.refreshContent();
                        });

In EJ2, refreshContent seems not working

Thanks.

Mohammed Farook J [Syncfusion]
Replied On November 26, 2018 12:15 PM UTC

Hi Costa, 
 
Thanks for contacting Syncfusion support. 
 
By default the Grid ‘addRecord’ method is automatically refresh the automatically.  Please find code example and the documentation for your reference. 
 
 
var gridObj = document.getElementById('Grid')['ej2_instances'][0]; 
gridObj.editModule.addRecord({ OrderID: 10247, CustomerID: 'VINET' }); 
 
 
 
 
Note : You must enable ‘allowAdding’ as true in Grid editSettings when using addRecord method. Please find the code example. 
 
 
 
<ejs-grid id="Grid"    toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" allowPaging="true"> 
            <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings> 
 
. . . 
 
 
 
This is not meet your requirement could you please explain more details about your requirement. 
 
Regards, 
J Mohammed Farook 


Costa
Replied On November 27, 2018 11:06 AM UTC

All right, thanks for correcting me)
However, if someone needs to refresh the data anyway, the method 'grid.refresh()' works to refresh the data in the grid.

Mohammed Farook J [Syncfusion]
Replied On November 27, 2018 12:50 PM UTC

Hi Costa,  
 
Thanks for your update. 
 
We are happy to hear that the provided solution has been resolved your problem.  The “refresh()” method of Grid will refresh the Grid header and content. 
 
Please get back to us if you need further assistance. 
 
Regards, 
J Mohammed Farook 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;