mardi 9 décembre 2014

5.1.0.70 chained store has no isMoving method

This was implemented a while back: EXTJS-14794 ChainedStore should support insert

This is reflected by the fact that ChainedStore implement mixin LocalStore, which has this method:



Code:



/**
* Inserts Model instances into the Store at the given index and fires the {@link #event-add} event.
* See also {@link #method-add}.
*
* @param {Number} index The start index at which to insert the passed Records.
* @param {Ext.data.Model/Ext.data.Model[]/Object/Object[]} records An `Ext.data.Model` instance, the
* data needed to populate an instance or an array of either of these.
*
* @return {Ext.data.Model[]} records The added records
*/
insert: function(index, records) {

When a model is inserted to ChainedStore, the store for the model is the chained store.

But then, a lot of methods are expected to exist in the store that own the model. So the chained store class need some methods usually called on a normal store. isMoving method exist in a normal store but not on a chained store.


ChainedStore class method:



Code:



onCollectionRemove: function(collection, info) {
var me = this,
records = info.items,
lastChunk = !info.next;

if (me.ignoreCollectionRemove) {
return;
}

me.fireEvent('remove', me, records, info.at, false);
// If there is a next property, that means there is another range that needs
// to be removed after this. Wait until everything is gone before firign datachanged
// since it should be a bulk operation
if (lastChunk) {
me.fireEvent('datachanged', me);
}
}

Model class method:


Code:



onStoreRemove: function(store, records, index, isMove) {
var me = this,
toDeselect = records,
moving, i, len, rec, moveMap;


// If the selection start point is among records being removed, we no longer have a selection start point.
if (me.selectionStart && Ext.Array.contains(records, me.selectionStart)) {
me.selectionStart = null;
}


if (isMove || me.locked || !me.pruneRemoved) {
return;
}


// Do a cheap check to see if the store is doing any moves before we branch into here
moveMap = store.isMoving(null, true);



Error stack for error: Uncaught TypeError: undefined is not a function


Code:



Ext.define.onStoreRemove (Model.js:991)
fire (Event.js:387)
doFireEvent (Observable.js:654)
prototype.doFireEvent (EventDomain.js:293)
fireEventArgs (Observable.js:587)
fireEvent (Observable.js:540)
Ext.define.onCollectionRemove (ChainedStore.js:166)
Ext.define.notify (Collection.js:2971)
Ext.define.splice (Collection.js:2103)
Ext.define.onCollectionRemove (Collection.js:2450)
Ext.define.notify (Collection.js:2971)
Ext.define.splice (Collection.js:2103)
Ext.define.itemChanged (Collection.js:1695)
Ext.define.afterChange (Store.js:563)
Ext.define.afterEdit (Store.js:572)
Ext.define.privates.callJoined (Model.js:2330)
Ext.define.endEdit (Model.js:833)
Ext.define.updateRecord (Basic.js:764)
Ext.define.completeEdit (RowEditor.js:986)
Ext.define.validateEdit (RowEditing.js:180)
Ext.define.completeEdit (RowEditing.js:172)
Ext.apply.callback (Util.js:110)
Ext.define.fireHandler (Button.js:1453)
Ext.define.onClick (Button.js:1438)
fire (Event.js:387)
Ext.define.fire (Dom.js:360)
Ext.define.publish (Dom.js:332)
Ext.define.doDelegatedEvent (Dom.js:391)
Ext.define.onDelegatedEvent (Dom.js:372)
Ext.Function.ExtFunction.bind.method (Function.js:145)





5.1.0.70 chained store has no isMoving method

Aucun commentaire:

Enregistrer un commentaire