/*!
- * Ext JS Library 3.2.0
+ * Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
*/
defaults: {
duration : 750,
- easing : 'easeIn',
idProperty: 'id'
},
previous = this.getRemaining(store),
existing = Ext.apply({}, previous, added);
+ //hide old items
+ Ext.each(removed, function(item) {
+ Ext.fly(this.dataviewID + '-' + item.get(this.idProperty)).fadeOut({
+ remove : false,
+ duration: duration / 1000,
+ useDisplay: true
+ });
+ }, this);
+
//store is empty
- if (calcItem == undefined) return;
+ if (calcItem == undefined) {
+ this.cacheStoreData(store);
+ return;
+ }
- var el = parentEl.child("#" + this.dataviewID + "-" + calcItem.get('id'));
+ var el = parentEl.child("#" + this.dataviewID + "-" + calcItem.get(this.idProperty));
//calculate the number of rows and columns we have
var itemCount = store.getCount(),
//find current positions of each element and save a reference in the elCache
Ext.iterate(previous, function(id, item) {
- var id = item.get('id'),
+ var id = item.get(this.idProperty),
el = elCache[id] = parentEl.child('#' + this.dataviewID + '-' + id);
- oldPositions[item.get('id')] = {
+ oldPositions[id] = {
top : el.getTop() - parentEl.getTop() - el.getMargins('t') - parentEl.getPadding('t'),
left: el.getLeft() - parentEl.getLeft() - el.getMargins('l') - parentEl.getPadding('l')
};
midLeft = oldLeft > newLeft ? oldLeft - diffLeft : oldLeft + diffLeft;
Ext.fly(dataviewID + '-' + id).applyStyles({
- top : midTop,
- left: midLeft
- });
+ top : midTop + 'px',
+ left: midLeft + 'px'
+ });
}
}
};
Ext.TaskMgr.start(task);
- //hide old items
- Ext.each(removed, function(item) {
- Ext.fly(this.dataviewID + '-' + item.get('id')).fadeOut({
- remove : false,
- duration: duration / 1000,
- useDisplay: true
- });
- }, this);
-
//show new items
Ext.iterate(added, function(id, item) {
- Ext.fly(this.dataviewID + '-' + item.get('id')).applyStyles({
+ Ext.fly(this.dataviewID + '-' + item.get(this.idProperty)).applyStyles({
top : newPositions[id].top,
left: newPositions[id].left
}).fadeIn({
this.cachedStoreData = {};
store.each(function(record) {
- this.cachedStoreData[record.get('id')] = record;
+ this.cachedStoreData[record.get(this.idProperty)] = record;
}, this);
},
var added = {};
store.each(function(record) {
- if (this.cachedStoreData[record.get('id')] == undefined) {
- added[record.get('id')] = record;
+ if (this.cachedStoreData[record.get(this.idProperty)] == undefined) {
+ added[record.get(this.idProperty)] = record;
}
}, this);
var removed = [];
for (var id in this.cachedStoreData) {
- if (store.findExact('id', Number(id)) == -1) removed.push(this.cachedStoreData[id]);
+ if (store.findExact(this.idProperty, Number(id)) == -1) removed.push(this.cachedStoreData[id]);
}
return removed;
var remaining = {};
store.each(function(record) {
- if (this.cachedStoreData[record.get('id')] != undefined) {
- remaining[record.get('id')] = record;
+ if (this.cachedStoreData[record.get(this.idProperty)] != undefined) {
+ remaining[record.get(this.idProperty)] = record;
}
}, this);