View Full Version : TemplateView.js, bug in refreshNodes()

20 Jan 2007, 2:19 AM
Hi Jack,

thanks four your unbelievable work on yui ext!

I think I ran into a bug in TemplateView.js:

YAHOO.ext.View.refreshNodes : function(dm, startIndex, endIndex){
var dm = this.dataModel;
var ns = this.nodes;
for(var i = startIndex; i <= endIndex; i++){
var d = this.prepareData(dm.getRow(i), i);
if(i < ns.length-1) {
var old = ns[i];
this.tpl.insertBefore(old, d);
this.tpl.append(this.el.dom, d);
this.updateIndexes(startIndex, endIndex);

The problem is the condition if(i < ns-length - 1):
Instead of the last node being updated in case of a change, a new node is inserted at the end of the view.
The condition should be fixed to (i < ns.length).

20 Jan 2007, 5:41 AM
Thanks, I put in the correction.