vitalets / angular-xeditable

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

Field does not update afteronsave #742

Closed brunobottazzini closed 4 years ago

brunobottazzini commented 5 years ago

Hello I am having an issue with the version 0.9.

<a href="#" editable-number="kgScorte" e-min="0" e-step="1" onbeforesave="onbeforesave($data)">{{ kgScorte | number: decimal }}</a>

To update the kgScorte we use:

$scope.kgScore = 0;

However, it is not working anymore after onbeforesave


$scope.onbeforesave = function(newKgScorte) {

       //Here we post the new value to backEnd

      // refreshValues();

     return true;
};

The refreshValues works fine. But I need to refresh a second time it does not work at all. It remains with the old value.

Do you know perhaps a way to update it manually? I took a look at this issue: https://github.com/vitalets/angular-xeditable/issues/130

but none of the answers worked for me unfortunately.

brunobottazzini commented 5 years ago

Update: I was able to force the refresh by adding

$("#editableNumber").text($scope.kgScorte).trigger('change');

However, the $parent.$data model does not update. So when we click in the number to update it shows the previous selected updated number. It works as half solution.

ckosloski commented 5 years ago

The documentation says you need to return true in order for the local model to be updated. Did you try that? http://vitalets.github.io/angular-xeditable/#onbeforesave

brunobottazzini commented 5 years ago

Hi @ckosloski,

Yes I put the 'return true;' but still the local model is not updated.

ckosloski commented 5 years ago

Do you have code you can post or an example in JSFiddle (or elsewhere) I can look at/

brunobottazzini commented 4 years ago

@ckosloski unfortunately I cannot provide you the code because I left the company I was working with.

I think you can close this issue if you want it

ckosloski commented 4 years ago

@eugef please close