Permalink
Browse files

Added unlinking in renderTmpl. (Perf bug).

  • Loading branch information...
1 parent 32bffb5 commit 4b2ad5ec227777493b171fcfef8fa2f2246df075 @BorisMoore committed Mar 16, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 beta2/jquery.datalink2.js
@@ -110,12 +110,16 @@ function changeArray( array, eventArgs ) {
}
}
+var prevLinksFrom, prevLinksTo;
+
function renderTmpl( el, data, tmpl ) {
$( el ).html(
$( tmpl ).tmplRender( data, { annotate: true })
);
- $.dataLink( data, el, { tmpl: tmpl }).pushValues();
- $.dataLink( el, data );
+ prevLinksFrom && prevLinksFrom.unlink();
+ prevLinksTo && prevLinksTo.unlink();
+ prevLinksFrom = $.dataLink( data, el, { tmpl: tmpl }).pushValues();
+ prevLinksTo = $.dataLink( el, data );
}
function addBinding( map, from, to, callback, links, viewItems ) {

0 comments on commit 4b2ad5e

Please sign in to comment.