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. Image for the cookie policy date

CRUD after refreshing datasource

Why the CRUD from the grid is not working after I set datasource from the code?
I will try to explain in the attached file.

Thanks.
Bernard.

Attachment: crud_d22aea8b.rar

3 Replies

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team February 6, 2020 03:19 PM UTC

Hi Bernard, 

Thanks for contacting Syncfusion Support. 
 
Query#:- Why the CRUD from the grid is not working after I set datasource from the code? 

We have checked your code example and we can reproduce the problem from your code. While on analyzing further you have updated the dataSource using dataSource method.  When we update using dataSource method, it will behaves like Local Data and we couldn’t perform CRUD operations on this.  

While using remoteSaveAdaptor, dataSource has been updated on model.dataSource.dataSource.json. So we suggest you to update the dataSource on model.dataSource.dataSource.json and refresh the Grid using refreshContent method 

Refer to the modified code example:- 

function onGodinaChange(args) { 
         var god = $("#cboxGodina").val(); 
         var obj = $("#gridPlan").data("ejGrid"); 
        var src = '@Url.Action("Data", "Grid", new { area = "" })'; 
        $.ajax({ 
            cache: false, 
            url: src, 
            data: { "Godina": god }, 
            type: "get" 
        }).done(function (data) { 
            obj.model.dataSource.dataSource.json = ej.parseJSON(Data); 
            obj.refreshContent(); 
             
        }).fail(function(xhr, status, error) { 
            var err = eval("(" + xhr.responseText + ")"); 
            alert("fail"); 
        }); 
    } 

Refer to the API Link:- 

Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana T 
  



BJ Bernard Jurlina February 6, 2020 08:53 PM UTC

Hi Farveen,

and thanks for the answer. Your solution is working perfect.

Regards!
Bernard.


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team February 7, 2020 12:22 PM UTC

Hi Bernard, 

Thanks for your update. Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana T  


Loader.
Live Chat Icon For mobile
Up arrow icon