PDA

View Full Version : Cell Editor Grid one cell modifies another cell's value



toole1
15 May 2012, 10:21 AM
I have a cell editor grid with several columns. On of the columns is to be a calculated value based on one of the other column values. I setup an edit event listener to monitor for the column value that can be editied to change. If it changes I use "e.record.set('TONS',e.value / 2000);" to calulate the value I want for the other column and put the value in there. The only problem is that if I tab out of the editable column and it hits the calculated column, editing stops and I have to click on the following column to continue. I tried making the calculcated column editable and do the calculation for both columns i.e. "e.record.set('LBS',e.value * 2000);" but the value that shows as editable is not the calculated value and I can't figure out how to change the value in the cell editor, the display value is fine. I also tried jumping over the calculated column with a check for editing in the column before, the problem with this is that the column after can be back-tabbed from and I cannot figure out how to determine in the edit event when the field is the subsequent field and back-tab was pressed. Any suggestions for any of the above scenerios to make one column show a calculated value and continue editing in the other cells would be appreciated.

15 May 2012, 11:47 AM
try committing your changes.

e.record.commit();

toole1
16 May 2012, 3:03 AM
Thanks for the response, Jay. That sort of works. When I enter a value in my Lbs field and tab to the Tons field, the value is whatever it was before in the Tons field. If I don't change the Tons value the value show the calculated value once I leave the field. If the Tons value changes the Lbs value changes when I leave the Tons field. It just doesn't happen right away. I added the e.record.commit() right after the e.record.set statement.