Skip to content

Commit

Permalink
Merge pull request #146 from jmfederico/develop
Browse files Browse the repository at this point in the history
Only trigger reset() initially if data hasn't changed. Fixes #145 #94
  • Loading branch information
crucialfelix committed Jan 18, 2016
2 parents a5e4706 + 5cde0d3 commit a7f85ad
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ajax_select/static/ajax_select/js/ajax_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
}
}

reset();
if (!$this.attr('data-changed')) {
reset();
$this.attr('data-changed', true);
}

$this.closest('form').on('reset', reset);

$this.bind('didAddPopup', function(event, pk, repr) {
Expand Down Expand Up @@ -115,7 +119,11 @@
$this.val(query);
}

reset();
if (!$this.attr('data-changed')) {
reset();
$this.attr('data-changed', true);
}

$this.closest('form').on('reset', reset);

$this.bind('didAddPopup', function(event, pk, repr) {
Expand Down

0 comments on commit a7f85ad

Please sign in to comment.