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

batch save

hi,

i am using the ejtreegrid to display and edit my hierarchical data

also i am aware of the endEdit and actionComplete events that can be used to send data to the server to persist modifications .

what i want if possible is to work locally in the client side, (add nodes/ delete/ update .... etc) and when happy with the results sand all the modifications with  a button for example to the  server (a controller or something) to persist .

the goal is to revert back to the original state if something wrong happen during the edit


any idea on how this could be done is welcome .

thanks .



1 Reply

JS Jonesherine Stephen Syncfusion Team November 22, 2016 05:08 PM UTC

Hi Issam, 
Thanks for contacting Syncfusion support 
We have prepared the work around and passed the updated data source to server side. 
To update the database with modified values we have deleted the existing values in a SQL table and populated the table with modified data source.  
We can save the data base in button click action otherwise we can revert changes by reloading the page without saving. 
Please find the code example for client side action: 
<button onclick="checkdata()" style="margin-top:20px">Submit</button>     
    <script>         
        function checkdata() {             
            var treeObj = $("#TreeGridContainer").data("ejTreeGrid"),              
              records = treeObj.model.dataSource; 
            $.ajax({ 
                type: "POST", 
                url: "TreeGrid/Update", 
                data: JSON.stringify({ Task: records }), 
                contentType: "application/json; charset=utf-8", 
                dataType: "json", 
            }); 
        }         
    </script> 
We have prepared the sample for your reference. Please find the sample from below location 
Disclaimer: We have removed bin and obj folder in the given sample for some security reasons, we must include Syncfusion.EJ and Syncfusion.EJ.MVC dlls to render the TreeGrid control which is available in Essential Studio installed location.   
Please let us know if you require further assistance on this.
Regards, 
Jone sherine P S
  


Loader.
Live Chat Icon For mobile
Up arrow icon