vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Editable Row - Cancel Edit on All Rows? #664

Closed westerncj closed 7 years ago

westerncj commented 7 years ago

If you have multiple rows in edit mode, is there anyway to cancel edit mode on all of them at once? If not, is there anything in $scope that would allow access to each form name for each row?

ckosloski commented 7 years ago

If you assign the same id to the cancel buttons for the row, you can do something like this:

$timeout(function() {
          angular.element(document.querySelectorAll("#cancel")).trigger('click');
      }, 50);
westerncj commented 7 years ago

That works awesome! Why the timeout?

ckosloski commented 7 years ago

It's just something I copied from something similar I was doing. Try it with out the timeout and see if it works. Please close this issue if your issue is resolved.

westerncj commented 7 years ago

Ok cool. Yeah if you remove the timeout you get a digest error. Thanks for your help!