Skip to content

Commit

Permalink
fix(kff.Binder): compare change of formatted values, not model values…
Browse files Browse the repository at this point in the history
… in modelChange method
  • Loading branch information
karfcz committed Jan 2, 2015
1 parent b8540c2 commit 5589498
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/kff.Binder.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ kff.Binder = kff.createClass(
*/
modelChange: function(event, force)
{
var modelValue;
var modelValue, formattedValue;
if(this.modelPathWatcher)
{
this.model = this.modelPathWatcher.model;
Expand Down Expand Up @@ -116,9 +116,10 @@ kff.Binder = kff.createClass(
}
if(modelValue !== 'undefined')
{
if(force || !this.compareValues(modelValue, this.currentValue))
formattedValue = this.format(modelValue);
if(force || !this.compareValues(formattedValue, this.value))
{
this.value = this.format(modelValue);
this.value = formattedValue;
this.currentValue = modelValue;
this.refresh();
}
Expand Down Expand Up @@ -178,6 +179,7 @@ kff.Binder = kff.createClass(
updateModel: function(value, event)
{
var i, l;
this.value = value;
if(value instanceof Array)
{
for(i = 0, l = value.length; i < l; i++) value[i] = this.parse(value[i]);
Expand Down

0 comments on commit 5589498

Please sign in to comment.