HI,
I am updating some rows in a Model Table and before saving, I am calling a JS Code Snippet. Inside the JS, I would like to compare the original database value of the fields with the new value that the user is about to save(). Is this possible ? If so, please help me with the syntax of accessing old existing values.
Thanks
Ebin
Page 1 / 1
Hi Ebin,
You can access the original values using model.getRowOriginals(row), which is the corollary of model.getRowChanges(row):
model.getRows().forEach(function(row) {
if (model.isRowChanged(row)) {
var rowId = model.getRowId(row);
console.log("Original values for row " + rowId, model.getRowOriginals(row));
console.log("User's changes for row " + rowId, model.getRowChanges(row));
}
});```
![](upload://4Lg2qOkwDlKhJLMmbG0IPHNK1Bp.png "Image httpsd2r1vs3d9006apcloudfrontnets3_images1827527RackMultipart20200306-27340-h8o4fs-Screen_Shot_2020-03-06_at_125028_PM_inlinepng1583517041")
Thank you Zach! Just what I was looking for. This is working for me.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.