This content has been marked as final. Show 1 reply
This is going to be a little/difficult complex. The valueCommitted event on the DataGrid should get triggered whenever anything in the DataGrid changes - whether it is by user action (editing a cell) or programmatic changes as you describe.
You also need an itemRenderer to make the visual change to the cell. If you are comfortable with itemRenderers, then this is how I would approach it. I have to say that I have not tried this, so use at your own risk.
You should also understand that itemRenderers are re-used when the DataGrid scrolls - so don't store anything in them that you think will be remembered for a particular cell.
When you detect that a value has changed, I would set a flag in the data itself - this is the only to guarantee that the information reaches the itemRenderer. For example, if you have 3 fields per record (product, quantity, price) and want to indicate when quantity changes, add a quantity_changed field and set it to true.
The itemRenderer will automatically be called upon to display the changed data. So you would think that alone would be enough. But keep in mind that the itemRenderer will also be called if the mouse sweeps over a cell or when the row is selected. That's why you need this flag to distinguish between the events.
In the itemRenderer, override the updateDisplayList function. This is where you will create and run the effect. From what you decribe, I would use states as that would be the easiest way to do this. Set the itemRenderer's backgroundColor (to red for example) and its backgroundAlpha to 0 so you don't see the red. That's the base state. In the "highlight" state, change the backgroundAlpha to 1.
You can use transitions to make the change happen. You will also need a Timer to change the state back.
In the updateDisplayList function, check the flag. If it is set, then change the state and start the timer. When the timer goes off, it should change the state back.
Becareful not to introduce any effect which will change the size of the cell or it will trigger updateDisplayList again and could lead to an infinite loop.
There are probably other ways to do this, but off the top of my head, I'd go this route and see where it leads.