I have a grid that has multiple cols, one col is amount - in this case I have an unchangable total amount say 200, my first row is the parent that will hold the 'unallocated' amt. so starting off it has 200, a row is added, put in 10 and the first row needs to change to 190. I have this working using (onCellEdit)
I have next to it a col of the %'s related to these dollar amounts. So when I enter the 10 its % needs to change to 5% and the top row when its value changes to 190 it also needs to change the % to 95. I have this mostly working in (onCellEdit)
The problem is both cols are editable, and if I directly change a $ and click directly into its % the old percentage is showing in the edit. I need to have it updated prior to going into edit - but how?
Pictures are worth 1000 words.
This is my grid with amounts and %s correct - before a change:
change one amount:
tab directly into the % - the value of 77 should change, but this is what i see when i directly click into it. you can see that my top row dollar amount has been changed, and the % of the first row also is updated.
If I move off this it then gets updated:
I don't know if there is a way to get it to do the calculations AS the user types instead of (onCellEdit) which seems to get hit after you leave the cell? Or is there a way to get this to complete prior to getting the 'enter edit mode'?
Hello Steven,
Thank you for contacting Infragistics Community!
I believe you will find the following sample very helpful in order to achieve the required. As you can observe I’m calling the igxGrid change detection right after updating the “Ordered” value (if the “Ordered” value > “Units in Stock” value). For example, on the first row, try to set “Ordered” to 40 and without submitting just click on “Units In Stock” and you will see that its value has been already updated. When omitting the detectChanges() the issue you are facing will be reproduced.
If this sample is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me for further investigation.
Looking forward to hearing from you.
Best Regards, Martin Evtimov Entry Level Software Developer Infragistics, Inc.
Thanks for the response, I was finally able to get my grid to behave in the manner I wanted.
Can I ask - where in the documentation is the detectChanges, as there may be other things in there than would be useful to know about.
Thanks.
I am glad that you find my colleague`s suggestions helpful for achieving your requirement.
In regards to Angular Change Detection there are a lot of article available online. You can have a look here and here. Hope these will be useful for you.
Thank you for using Infragistics components.