PDA

View Full Version : where is GridView.onRemove ?



seno
20 Feb 2007, 5:23 AM
i remove a record in grid using ds.remove(record) method
but can't remove record with the same error:
l.fireFn has no properties

GridView.js


if(ds){
ds.on("datachanged", this.onDataChange, this);
ds.on("add", this.onAdd, this);
ds.on("remove", this.onRemove, this);
ds.on("update", this.onUpdate, this);
ds.on("clear", this.onClear, this);
}

but i can't find GridView.OnRemove method, this is a bug or not completed:)
sorry for my english:)

jack.slocum
20 Feb 2007, 5:35 AM
It's a bug, the function is there but it's called "onDelete". I renamed onDelete to onRemove and all is well (also a change in onUpdate where it calls onDelete).

seno
20 Feb 2007, 7:05 AM
i rename onDelete to onRemove,but there is another bug

Store.js


remove : function(record){
var index = this.data.indexOf(record);
this.data.removeAt(index);
this.fireEvent("remove", this, record, index);
}


ds.remove method delete record, then fire GridView.onRemove


onRemove : function(ds, record, isUpdate){
var index = typeof record == "number" ? record : this.ds.indexOf(record);
...
}

index always be -1 because record is deleted

jack.slocum
20 Feb 2007, 8:02 AM
I redeployed - check the new version. ;)

cchiriac
22 Feb 2007, 8:21 AM
same function name problem in View.js (onDelete vs. onRemove)

Also, there are references to
this.ds
It should be
this.store now, right ?





onDelete : function(ds, record){
this.clearSelections();
var index = this.ds.indexOf(record);
this.el.dom.removeChild(this.nodes[index]);
this.updateIndexes(index);
}




onUpdate : function(ds, record){
this.clearSelections();
var index = this.ds.indexOf(record);
var n = this.nodes[index];
this.tpl.insertBefore(n, this.prepareData(record.data));
n.parentNode.removeChild(n);
this.updateIndexes(index, index);
}

jack.slocum
22 Feb 2007, 4:28 PM
Thanks, I put in your fixes.