dynamic listen for model close

  • 2
  • Idea
  • Updated 4 years ago
  • Implemented
In a sharing mood today. :D

Similar to this blog but slightly updated code.


// Listen for popup close of new record using just one model.
// Snippet to be called after creating new row AND displaying popup
// Only downside to this is that saving the model in the popup also saves any 
// other edits in the model.
skuid.snippet.registerSnippet('listenForPopupClose',function(args) {
    var params = arguments[0],
    $ = skuid.$,
    row = params.context.row,
    model = params.context.model;

            "beforeClose" : function()
                var numOfChanges = Object.keys(model.changes).length;    

                // if there is more than row that is currently changed (new, marked for deletion, edited) then this new row will be abandoned.
                if (numOfChanges > 1){
                // otherwise just mark if for deletion and save
                } else if (numOfChanges == 1) {
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 43,156 Points 20k badge 2x thumb

Posted 4 years ago

  • 2
Photo of Anna Wiersema

Anna Wiersema

  • 10,910 Points 10k badge 2x thumb
How happy are the days when Pat's in a sharing mood! Thanks for all this good stuff!