Value before field updated

Craig RosenbaumCraig Rosenbaum Member, Sonar ✭✭
edited June 25 in Questions
Is there a way to see the old value of a field just before update in javascript. The params passed to a snippet after field update list the new value but I do not see a way to access the old. Similarly to trigger.old and trigger.new, but with just one value.

I also did not see a way to do it with a custom skuid.event subscription. 

Example:

Field was changed from 10 to 15. I would like to access the old value of '10' 

Comments

  • Pat VachonPat Vachon Member 💎💎💎
    edited June 25
    The model has a property of something like originalValues that you can reference by field.
  • Craig RosenbaumCraig Rosenbaum Member, Sonar ✭✭
    edited September 2019
    Pat - you're exactly right. I was stuck on the event subscription I didn't think about going to the model. For anyone else looking for this, it is on the object and accessible through 'originals[rowId][fieldLabel]
  • Barry SchnellBarry Schnell Member ✭✭
    edited June 2017
    Hey guys -

    One thing to keep in mind that originals (formerly originalValues) is the original value of the field - not necessarily the value of the field prior to an update.  

    If the field has been updated more than once, originalValues will not give you the 'before' value.  The purpose of this field is to support "Cancel Changes' which takes the row back to it's original state.  

    I can't remember the argument values on model events but if the row updated doesn't have the before value, it would be nice to see that added.  Taking that thought process a step farther, would be nice to be able to cancel an update as well.  Ideally, a "beforeChange" event offering before value, after value and ability to return false to cancel the update.
Sign In or Register to comment.