Editing a cell in a DataGrid
Terence Heaford
t.heaford at icloud.com
Sun May 10 05:14:32 EDT 2015
On investigation it appears the CloseFieldEditor is sent before the data is updated into the table so I had to obtain the oldData to make my adjustments as the new data affects a calculation to obtain the sum of the column.
See this script:
on CloseFieldEditor pFieldEditor
put the text of pFieldEditor into tNewValue
put the dgColumn of the target into tColumnName
put the dgHilitedLines of me into tLine
put the dgDataOfLine[tLine] of me into tData
put tData[tColumnName] into tOldValue
put tData["recID"] into tRecID
if tColumnName = "budget" then
put tNewValue - tOldValue into tChangedValue
add tChangedValue to fld "budget"
add tChangedValue to fld "remaining"
end if
saveCellDataToDB tRecID,tColumnName,tNewValue
end CloseFieldEditor
It is a shame that the DataGrid does not send a message when ALL the updating of the DataGrid is complete?
All the best
Terry
More information about the use-livecode
mailing list