Thank you for reporting this bug. We will make it our priority to review this report.
TreeStore applyRootNode incorrectly sets rootNode.store and rootNode.treeStore
TreeStore applyRootNode incorrectly sets rootNode.store and rootNode.treeStore
I noticed this when my tree panel view was not updating when passed a model which had not fully loaded. In the fiddle below you'll see a root node appear empty which is because at the time of setting the root node all attributes besides id had not been loaded in yet.
I narrowed this down to TreeStore.applyRootNode which only sets the store and treeStore properties on the node if it was not a model first. My override for this is included in the fiddle but I'll also include it here.
Code:
Ext.define('Test.override.data.TreeStore',{
override : 'Ext.data.TreeStore',
applyRoot : function(newRoot){
newRoot = this.callOverridden(arguments);
if(newRoot){
newRoot.store = newRoot.treeStore = this;
}
return newRoot;
}
});Offending code from Ext.data.TreeStore
Code:
applyRoot: function(newRoot) {
var me = this,
Model = me.getModel(),
idProperty = Model.prototype.idProperty;
// Convert to a node. Even if they are passing a normal Model, the Model will not yet
// have been decorated with the constructor which initializes properties, so we always
// have to construct a new node if the passed root is not a Node.
if (newRoot && !newRoot.isNode) {
// create a default rootNode and create internal data struct.
newRoot = Ext.apply({
text: me.defaultRootText,
root: true,
isFirst: true,
isLast: true,
depth: 0,
index: 0,
parentId: null,
allowDrag: false
}, newRoot);
if (me.defaultRootId && newRoot[idProperty] === undefined) {
newRoot[idProperty] = me.defaultRootId;
}
// Specify that the data object is raw, and converters will need to be caled
newRoot = new Model(newRoot);
// The root node is the only node bound to the TreeStore by a reference.
// All descendant nodes acquire a reference to their TreeStore by interrogating the patrentNode axis.
// The rootNode never joins this Store. It is bound and unbound in applyRoot and updateRoot
newRoot.store = newRoot.treeStore = me;
}
return newRoot;
},
TreeStore applyRootNode incorrectly sets rootNode.store and rootNode.treeStore
Aucun commentaire:
Enregistrer un commentaire