PDA

View Full Version : [FIXED][3.1] Online ItemSelector example gives error



canxss
25 Dec 2009, 12:33 PM
Hi,

Please check out the online ItemSelector example (http://www.extjs.com/deploy/dev/examples/multiselect/multiselect-demo.html). When you drag an item from Available to Selected box and then select that item it gives the following error:
this.store.getAt(selectionsArray[i]) is undefined

Thanks

Condor
27 Dec 2009, 11:20 PM
Yes, that's a bug.

Here is the fix:

Ext.override(Ext.ux.form.MultiSelect, {
onNodeDrop : function(n, dd, e, data){
if (this.ms.fireEvent("drop", this, n, dd, e, data) === false) {
return false;
}
var pt = this.getDropPoint(e, n, dd);
if (n != this.ms.fs.body.dom) {
n = this.view.findItemFromChild(n);
}
var insertAt;
if (this.ms.appendOnly) {
insertAt = this.view.store.getCount();
} else {
insertAt = n == this.ms.fs.body.dom ? this.view.store.getCount() - 1 : this.view.indexOf(n);
if (pt == "below") {
insertAt++;
}
}
var dir = false;
if (data.sourceView == this.view) {
if (pt == "below") {
if (data.viewNodes[0] == n) {
data.viewNodes.shift();
}
} else {
if (data.viewNodes[data.viewNodes.length - 1] == n) {
data.viewNodes.pop();
}
}
if (!data.viewNodes.length) {
return false;
}
if (insertAt > this.view.store.indexOf(data.records[0])) {
dir = 'down';
insertAt--;
}
}
for (var i = 0; i < data.records.length; i++) {
var r = data.records[i];
if (data.sourceView) {
data.sourceView.store.remove(r);
}
this.view.store.insert(dir == 'down' ? insertAt : insertAt++, r);
var si = this.view.store.sortInfo;
if(si){
this.view.store.sort(si.field, si.direction);
}
}
return true;
}
});

hendricd
28 Dec 2009, 11:05 AM
Fixed in SVN for Ext 3.1.1.