Refresh dataSource grid

Hi, i refresh my grid data.

     var gridObj = $("#EffectifParent").data("ejGrid");
     gridObj.dataSource(ej.parseJSON(result), true);

After refresh, I can not use add, edit and delete functions anymore.

There is a solution to this problem?

Thanks

3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team December 15, 2017 11:30 AM UTC

Hi Arnaud, 

Thanks for using Syncfusion support. 

We went through your code example that you have shared for us and found that you are dynamically changing the data source using AJAX function and we suspect that you are bounding remote datasource using data adaptor initially with CRUD Urls. In that, after changing the data source CRUD operation can’t be performed at server side. But you are bound the normal JSON data array through AJAX function or some other functions. 
 If so, server side Actions methods are not called after changing the data source, because if we bound the normal JSON datasource then it will work like a local datasource with JSON adaptor (default adaptor).  
 
If you want to call the server side actions methods after the refreshing the data then we suggest you to update the data source with remote save adaptor like as follows,  
success: function(data) {  
            var data = ej.parseJSON(data);  
            var dataManager = ej.DataManager({  
                json:data, 
                 
                crudUrl: "/Home/WalkinItemUpdate ", 
                adaptor: "RemoteSaveAdaptor",  
                  
            });  
  
            $("#GridID").ejGrid({ dataSource: dataManager }); 
  
} 
 
Note: In above code example, we have used remote save adaptor. This adaptor is only applicable for local data source. Because, you have bounded the local data source in some function. Here, we can perform the CRUD operation in server side. 
Please refer to the following Help documentation for more information, 
If we misunderstood your requirement, then could you please provide more details about your requirement with exact scenario? It would be helpful for us to find the problem and provide the better solution as earliest. 
 
Regards, 
Venkatesh Ayothiraman. 



AB Arnaud--Mozdzer Bastien December 15, 2017 04:30 PM UTC

Hello, thank you for your reply it works.

For information I use the URL Adaptor so :

var data = ej.parseJSON(data);
var dataManager = ej.DataManager({
     json: data,
     insertURL: "../Effectif/InsertParent",
     updateURL: "../Effectif/UpdateParent",
     removeURL: "../Effectif/DeleteParent",
     adaptor: "RemoteSaveAdaptor"
});

$("#EffectifParent").ejGrid({ dataSource: dataManager });


VA Venkatesh Ayothi Raman Syncfusion Team December 18, 2017 04:00 AM UTC

Hi Arnaud, 

Thanks for the update. 

We are very happy to hear that your requirement is achieved. 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon