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

modify newly added nodes

Thread ID:





127529 Nov 21,2016 04:19 PM UTC Nov 22,2016 05:14 PM UTC JavaScript 1
Tags: ejTreeGrid
Asked On November 21, 2016 04:19 PM UTC

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 .

Jonesherine Stephen [Syncfusion]
Replied On 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 


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