Skip to content

Commit

Permalink
Allow the editable function to be set as an option
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwins committed Feb 16, 2014
1 parent 48c76ac commit 0a3cfdf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions js/scat.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,16 @@ ko.bindingHandlers.jeditable = {
     options.onblur = 'submit';
    }

// allow the editable function to be set as an option
if (!options.onupdate) {
options.onupdate= function(value, params) {
     valueAccessor()(value);
      return value;
}
}

    // set the value on submit and pass the editable the options
    $(element).editable(function(value, params) {
     valueAccessor()(value);
      return value;
    }, options);
    $(element).editable(options.onupdate, options);

    //handle disposal (if KO removes by the template binding)
    ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
Expand Down

0 comments on commit 0a3cfdf

Please sign in to comment.