Posted 14 September 2017, 12:01 pm EST
We’ve got a FlexGrid (using the AngularJS version with AngularJS 1.5.9) where we want to update multiple cells in response to a user editing a single cell’s value. For example, if you were to edit the first numeric value in a row to be less than the succeeding values, those values would be reduced to match the first value across the row until it hit one which was already less.
I’ve got a very simplified example in this Plunker here where I attempt to use setAt() on our ObservableArray of values in response to a button click, the “deleteRow” handler, and the “cellEditEnding” handler: http://plnkr.co/edit/YMqSSj7NKVK1Hv5zBcjc?p=preview
Look at the code at the bottom of script.js and you’ll see that all three of those things call exactly the same code to set the prices across a single row in response to an event.
1: Click the button at the top of the page, you’ll notice the first row will change all its numbers to 12, 11, 10… If you arrow around within the grid, everything is good.
2: Reload the page and click at the start of the second or third row to select it. Then hit the delete key. That will invoke the “deleteRow” handler, and again the first row will change (not the row you clicked on, but this is just an example) and you can cursor around without any problems.
3: Pick a numeric cell somewhere other than the first row and change it. After you accept the change the first row WILL NOT update and even worse the cursor in the grid no longer works correctly. You cannot be on the second row and arrow onto the first row, your cursor will disappear! You can be on the first row and cursor onto the second but not go back onto the first row!
In all three cases we called the same function, in two out of the three (one of them an event handler) it worked just fine.
