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

modify newly added nodes

i am using the ejtreegrid to display and edit my hierarchical data . also i am using the actionComplete event to send data to my asp.net controller to persist data . here the code of my controller :

      public int AddFamille(string DESIGNATION)
                FAMILLE f = new FAMILLE()
                    FA_DESIGNATION = DESIGNATION,
                    FA_ID_PARENT = 1};
                return f.ID_FAMILLE;

it return the ID of the newly added entity , i have checked that and it's ok .

on the client side here the ajax call

    function OnactionComplete(args) {
      if (args.requestType == "addNewRow") {
                        var item = args.addedRow;
                            type: "POST",
                            url: '/Admin/AddFamille?`DESIGNATION='+item.DESIGNATION,`

                            success: function (data) {
                                args.addedRow.ID= data;

as you can see i am trying replace the added item ID with the new ID that came from the server, but unfortunally it has no effect .

any idea is welcome, thanks .

1 Reply

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

Hi Issam, 
Thanks for contacting Syncfusion support 
By using “refreshRow” public method we can refresh the specific row in TreeGrid. 
We have prepared the work around and refreshed the newly added row by using refreshRow public method. 
Please find the code example below: 
function actionComplete(eventArgs) {           
            var treeObj = this, 
                //To get the index of newly added row 
                addedRow = treeObj.model.selectedItem; 
            if (eventArgs.requestType === 'addNewRow') {                 
                //Newly Added Record is obtained here , which can be updated to database 
                var addedRecord = eventArgs.addedRow; 
                    type: "POST", 
                    data: { Name: addedRecord.TaskName }, 
                    dataType: "json",                    
                    url: "/TreeGrid/Add",//Add is Server side method 
                    success: function (result) {                        
                        addedRow.TaskId = addedRow.item.TaskId = result; 
                        //To refresh the newly added row                             treeObj.refreshRow(treeObj.model.updatedRecords.indexOf(addedRow)); 
We have prepared the sample based on your requirement. Please find the sample from below location 
Jone sherine P S 

Live Chat Icon For mobile
Up arrow icon