This is a migrated thread and some comments may be shown as answers.

Not updating child rows on hierarchy grid client side

0 Answers 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 17 Feb 2017, 09:51 PM

I am going to do my best to explain my current issue.

I am currently have a hierarchy radgrid in batch edit mode. I am trying to update all child rows based on a value in the parent row. For instance, lest's say my parent row has a column: "Qty". My child row or nested row has two columns: "Percent", "NewQty". When I update my "Qty" it calculates and updates my "NewQty" for each nested/child row. The calculation would simply be "Qty" * "Percent". I currently have this working using the OnBatchEditValueChanged event using the code below:

var row = args.get_row();
var editorValue = args.get_editorValue();
var batchManager = sender.get_batchEditingManager();
var dataItem = $find(row.id);
if (dataItem.get_nestedViews().length > 0) {
         var nestedView = dataItem.get_nestedViews()[0];
          var nestedDataItems = nestedView.get_dataItems();
 
          for (var i = 0; i < nestedDataItems.length; i++) {
                var percent = batchManager.getCellValue(nestedDataItems[i].get_cell("Percent"));
                var newQtyId = nestedDataItems[i].get_cell("newQty");
                 var newQty = editorValue * percent;
                   batchManager.changeCellValue(newQtyId, newQty);
            }
 }

 

This loops through my nested view and and updates each row and cell with the calculated value. This seems to work great, however if I change my "Qty" value back to it's original value, for instance if it was set to 100 then set to 200 then back to 100, it will only update the first nested/child row but not any row after that. It's like it doesn't allow you to edit those cells when the original value is changed back.

I'm not sure if this is a bug or the way it is supposed to be. Or if I am just doing it the wrong way. Any help on this would be great.

 

Thanks,

Tony

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Tony
Top achievements
Rank 1
Share this question
or