Issue while deleting child

Hi SyncFusion,

I'm currently facing several issues with the treeGrid component.
The first one is that the double click isn't working properly, some time i have to double click several times before the edit action start, and i don't see why.
Secondly, when i'm adding a new child row (you have to set weight first then do a select on the left), the name isn't set in the cell. I have created a setFractionText functions to add the id fom the select first but also to force the select text choosed but it partially works, sometimes the text get back to the original text.
You can also add a new row on the same level by changing percentage of the first created child row.
Thirdly, when i'm at this state :


And i click the checkbox, it will change the 'type' of the children row. For that i'm deleting the child row then add a new row to the parent. Unfortunately, when doing so the deleting doesn't seem to work properly because the hasChildRecords property is set to false but the childRecords still contains the previous line.
So it creates a mess :


Here the output in the console on the actionComplete methods after the delete :


One other thing i don't get is there is that the data that we can see in the action's methods are not always the same in the taskData (and what is the role of this taskData).
That why in the actionComplete i have to add this to be sure to have the proper weight and i think it's wrong. Please,if you can let me know why it's is like that.
let totalPercentageLevel = args.previousData === rowData.PoidsPourcentage ? rowData.taskData.PoidsPourcentage : rowData.PoidsPourcentage;
If i don't check the weight is different from the previous i get back with a wrong weight but not with the taskData weight...

You'll find the repository project in attachement.
I'm sorry to bother you with all that and if it's too much to ask, just say so.

Thanks for your time

Regards


13 Replies

PG Piedrot Gyzmo September 16, 2020 03:33 PM UTC

I have change the uploaded file.

Attachment: syncfusion_4ceed30d.zip


MP Manivannan Padmanaban Syncfusion Team September 17, 2020 01:06 PM UTC

Hi Piedrot, 

Greetings from Syncfusion Support. 

Query 1: double click isn't working properly, 

We are unable to replicate the reported issue in the shared sample, please refer to the video demonstration link below. 

  1. Share the issue replication procedure with detailed explanation.

Query 2 & 3: Add and delete issue. 
 
We are unable to perform add and delete actions in the shared sample, we request you to get back to us with the below details. 
  1. Share the issue replication procedure/video demonstration.
  2. In the query, you stated that "you have to set the weight first, then select the left" to add the child rows”. But we are quite unclear about where to add the weight. Please describe this in detail.

Query 4: action's methods are not always the same in the taskData (and what is the role of this taskData). 

In the shared screenshot, we didn’t find any differences in the taskData. Please expand the taskData and show us whether any specific value is changed, which help us to validate further. And taskData is an internal property like every other properties level, index etc., 

Provided details, will help us to validate and resolve the reported issues as early as possible. 

Regards, 
Manivannan Padmanaban  



PG Piedrot Gyzmo September 21, 2020 10:31 AM UTC

Hi Manivannan,

Thank you for your response and sorry if i wasn't clear enough.

Query 1 & 2 & 3 : You'll find a short video describing the double clic event that doesn't trigger correctly and the row that is not added properly (mainly because i think the previous row is not deleted properly).
Those adding/deleting actions are called by the finalChange function in services.js

Query 4 : Nevermind it seems to work fine now without doing what i was doing before. Doesn't really know why it was wrong at the first place

Please let me know if you need more informations.

Regards

Attachment: 20200921_12h05_16_d9d1aea9.zip


MP Manivannan Padmanaban Syncfusion Team September 23, 2020 05:06 AM UTC

Hi Piedrot, 

Thanks for the details. 

Query 1: 

We are able to reproduce the reported issue at our end. We will consider this “Edit double click is not working properly” issue as bug and logged a defect report for the same. Thank you for taking the time to report the issue and helping us improve our product. At Syncfusion we are committed to fixing all the validated defect (subject to technological feasibility and Product Development Life Cycle) and including its fix in our subsequent release. The fix for the issue will be included in our upcoming patch release after Volume 3 2020 main release which is expected to be rolled out by the second week of October 2020. 

You can track the current status of your request, review the resolution timeline and contact us for any further inquiries through this link.    

Note: To view the above feedback, kindly login into your account.      

Query 2 & 3: 

Based on the shared video demonstration, we have tried to replicate the reported problem in the previously shared sample. But we are unable to replicate the reported problem at our end. We are able to perform the delete and add operations properly. Refer to the link below for video demonstration, 


So, we ask you to reproduce the reported issue in the above sample and return to us with a video demonstration to replicate the issue. 

Regards, 
Manivannan Padmanaban 



PG Piedrot Gyzmo September 23, 2020 10:04 AM UTC

Hi Manivannan,

Query 1 : Ok, i'll look forward to see the issue resolved. Thank you for having considered it.

Query 2 & 3 : When i send the folder at the first place, i didn't took time to check if it was working as expected, my bad.
So when i opened your version, i saw some little changes but also an error i didn't changed in this version.When i'm calling the setNewRow i'm sending a treegridInstance that is used as rowData so it was probably creating a bug in your version.
So i changed that but it doesn't resolve the issue. It's happening when i'm replacing a grand child. If there is only one child, the grand child is change properly, but if the child is between two other, the there is an issue when replacing.
You'll find a new video in attachment but it's the same content as the previous one.

Thank you again for your time

Regards.

Attachment: 20200923_11h51_37_86e70776.zip


PG Piedrot Gyzmo September 23, 2020 10:11 AM UTC

I forgot to send you the revised project.

Regards

Attachment: syncfusion_4ceed30d_new_65c94ef9.zip


MP Manivannan Padmanaban Syncfusion Team September 24, 2020 01:53 PM UTC

Hi Piedrot,  

Thanks for the update.  

We are able to reproduce the reported issue in the shared sample and we are validating the same with high priority, will update you the response on 25th September 2020 

Until, then we appreciate your patience. 

Regards, 
Manivannan Padmanaban 




MP Manivannan Padmanaban Syncfusion Team September 25, 2020 01:46 PM UTC

Hi Piedrot, 
  
We appreciate your patience with us.  
  
On further validation, we could see that you used the rowData variable obtained from the checkboxChange event in the finalChange method and that you used the same rowData variable to add action after the deleteRows method was called. Since the childRecords was not removed from rowData variable and this leads to the reported issue
  
So, to overcome this we suggest you to empty the childRecords in rowData variable by checking the actionComplete args data. Refer to the below code example, 
  
// method.js file 
  
  
    actionCompletefunction (args) { 
     ………………. 
  
     ifthis.pendingAction ){ 
            if (args.requestType === 'delete') { 
                this.pendingAction(args)// pass args to update the rowData on pendingAction method. 
            } 
            this.pendingAction = undefined; 
        } 
    }, 
  
// services.js file 
  
    finalChangefunction ( answer, rowData) { 
        ……………… 
        if (answer) { 
            if (rowData.hasChildRecords && rowData.childRecords[0].TypeLigne === 'FR') { 
……………………………….. 
                this.pendingAction = (args) => { 
                    rowData.FractionText = "New Child Added"; 
                    if(args.data[0].Key == rowData.childRecords[0].Key){ // check the primary key data here, use your primary key field name. 
                            rowData.childRecords = []; // if record deleted then, empty the  childRecords from rowData variable  before passing it into addNewRecord method 
                    }   
                   this.addNewRecord(rowData, 'FR''Child', rowData.Poids, 100) 
                } 
                ………………… 
            } else if (rowData.hasChildRecords && rowData.childRecords[0].TypeLigne === 'FM') { 
……………………………… 
                 
            } 
        ……………… 
    }, 
  
  
  
Output 
 
  
For your convenience, we have modified the shared sample refer to the link below. 
  
Please get back to us, if you need further assistance. We will be happy to assist you. 
  
Regards, 
Manivannan Padmanaban   



PG Piedrot Gyzmo September 30, 2020 10:35 AM UTC

Hi Manivannan,

Thank you for your answer, it is what i was,kind of doing execpt i wasn't setting the childRecords property to an empty array.

Query 1 : By the way, why is there no deleteChildren methods for TreeGrid ? It doesn't seem to be a really 'clean' way to use deleteRecord first then to set property 
childRecords to an empty array. I also had to add a getAllChidlren function to retrieve all level of children to be able to delete them. Would you consider to add this feature to TreeGrid so it could delete children, grand-children, grand-grand-chilren ?

Query 2 : I'm still confused about something. When you choose an item in the DropDownList, a child row is created. The issue i don't get is that, if i'm not using the setFractionText function i created in methods.js (which is basically an updateRow), the value of the text get back to it's previous value, why ? The add action row is launch after the actionComplete, so why does it get back ? You'll find a video about that and some comment in the code.

Query 3 : I have the same behavior when i'm selecting the item 'Pertes' in the DropDownList of first row. You'll find a second video to show you what i'm facing. But basicaly, when i'm choosing the 'Pertes' item i'm deleting all children and only parent remain. But before deleting there is a validation DialogBox. Before pressing Yes, the 'Pertes' text is set, but after pressing Yes and the children get deleted, it gets back to it's previous value.
The dialog box is launch at the actionBegin edit, so maybe is it related.

Again sorry if i misundertood something about TreeGrid and thank you for your time.

Regards.


Attachment: sync_e9fc2e90.zip


MP Manivannan Padmanaban Syncfusion Team October 1, 2020 01:29 PM UTC

Hi Piedrot, 

Thanks for the update. 

Query 1: deleteRecord issue 

The Tree Grid deleteRecord method will delete the particular record and all of its children ( i.e. child and grandchild) there is no need to empty the child records separately. In your case, the variable named rowData has been passed to the addRecord method. As we mentioned earlier, you get the value of the rowData variable from the checkboxChange event before deletion of the record, and you used the same variable rowData in the addRecord method ( i.e. got in the event args checkboxChange). 

After delete action was done, you did not change/update the rowData variable and used the same old one to addRecord. So, to avoid the reported problem  we suggest that you empty the childrecords in the old rowData variable based on the actionComplete delete args data. 

Query 2: without setFractionText function text back to its previous value 
 
We are able to reproduce the reported issue and currently we are validating the same, will update you the further information on October 6, 2020. 

Query 3: After delete 'Pertes' text is back to its previous value. 

We are unable to replicate the reported issue in the shared sample, please refer to the video demo link below. 

So, in order to proceed further we request you to get back to us with the issue reproducible sample. 

Note: we have commented the setFractionText method but still unable to reproduce the issue in the shared sample. 

Regards, 
Manivannan Padmanaban 



FS Farveen Sulthana Thameeztheen Basha Syncfusion Team October 6, 2020 02:27 PM UTC

Hi Piedrot, 

We appreciate your patience. 
 
Query#:- Without setFractionText function text back to its previous value. 
 
Further analyzing your sample,  you have added new childRecord on Dropdown change of the  parent record. Also you have updated both same parent and child grid records with saveTreeState using getCurrentViewRecords method.  

In that scenario(after using updateRow method (i.e Poids field value from your sample) getCurrentViewRecords method not updated (i.e FractionText field value) edited values properly(same row). So the reported problem occurs. .  

We have confirmed this as Bug “getCurrentViewRecords method not updated properly when we save the edited records after using updateRow method” for this scenario. Thank you for the taking the time to report the issue and helping us improve our product. At Syncfusion we are committed to fixing all the validated defect (subject to technological feasibility and Product Development Life Cycle) and including its fix in our subsequent release. The fix for the same will be included in our October 3rd week patch release. 
 
You can track the current status of your request, review the resolution timeline and contact us for any further inquiries through this link.      
 
Disclaimer:- You can view the feedback once it is moved to validated state. 

Until we suggest you to use the workaround with setFractionText function to overcome this problem. 
 
Regards, 
Farveen sulthana T 



PG Piedrot Gyzmo October 7, 2020 08:49 AM UTC

Hi Manivannan and Farveen,

Thank you for the update and your analysis of my code, it helps to understand what's going wrong.

I look forward to see the update.

Thank you again.

Regards


GL Gowri Loganathan Syncfusion Team October 8, 2020 11:07 AM UTC

Hi Piedrot, 
 
Most welcome. 
 
We will let you know, when the patch is rolled out. 
 
Until then we appreciate your patience. 
 
Regards, 
Gowri V L 
 


Loader.
Up arrow icon