PDA

View Full Version : TreePanel Update



dotti
7 Jul 2013, 12:08 PM
Hi,

I try to update my remote tree panel by using load() or reload() Function.
On Ext4.07 this did reload the full tree including the expanded child node's.

On Ext4.21 it only loads the root node.
To load the Child node's I have to click twice on the expand symbol.

Is there any BUG?

mfg

Klaus

capadleman
8 Jul 2013, 1:23 AM
Can you show some code ?
are you using any plugins ?

Farish
8 Jul 2013, 6:50 AM
are you using expanded: true in your root config?

dotti
10 Jul 2013, 9:11 PM
I will upload some code later.
I do not use plugins for the tree.
Yes I use expanded for the root itself an for some node's of the root.
The first time the tree is loaded alle node's are loaded. But on load() for the root node only the root node ist loaded. On older Version alle expanded node's are loaded.

dotti
13 Jul 2013, 3:09 AM
If I load the root node with child node's with the property expanded then the first time the child node's loaded automatically but the seconded time I load the root it look's like the child store's are erased but the child's store's do not send an load request to the server.

Is there any Place in the Tree Class where the root node store load the child store's if they are expanded?

dotti
13 Jul 2013, 6:12 AM
Now I found the part of the extjs code what makes the difference:

V4.2.1


fillNode: function(node, newNodes) {
var me = this,
ln = newNodes ? newNodes.length : 0,
sorters = me.sorters,
i, sortCollection,
needsIndexSort = false,
performLocalSort = ln && me.sortOnLoad && !me.remoteSort && sorters && sorters.items && sorters.items.length,
node1, node2, rootFill;


for (i = 1; i < ln; i++) {
node1 = newNodes[i];
node2 = newNodes[i - 1];
needsIndexSort = node1[node1.persistenceProperty].index != node2[node2.persistenceProperty].index;
if (needsIndexSort) {
break;
}
}


if (performLocalSort) {

if (needsIndexSort) {
me.sorters.insert(0, me.indexSorter);
}
sortCollection = new Ext.util.MixedCollection();
sortCollection.addAll(newNodes);
sortCollection.sort(me.sorters.items);
newNodes = sortCollection.items;


me.sorters.remove(me.indexSorter);
} else if (needsIndexSort) {
Ext.Array.sort(newNodes, me.sortByIndex);
}

node.set('loaded', true);





rootFill = me.fillCount === 0;
if (rootFill) {

me.fireEvent('beforefill', me, node, newNodes);
}
++me.fillCount;

if (newNodes.length) {
node.appendChild(newNodes, undefined, true);
}

if (rootFill) {

me.fireEvent('fillcomplete', me, node, newNodes);
}
--me.fillCount;

return newNodes;
}


older Version which works


Ext.override(Ext.data.TreeStore, {
fillNode: function(node, newNodes) {
var me = this,
ln = newNodes ? newNodes.length : 0,
sorters = me.sorters,
i, sortCollection,
needsIndexSort = false,
performLocalSort = ln && me.sortOnLoad && !me.remoteSort && sorters && sorters.items && sorters.items.length,
node1, node2;


for (i = 1; i < ln; i++) {
node1 = newNodes[i];
node2 = newNodes[i - 1];
needsIndexSort = node1[node1.persistenceProperty].index != node2[node2.persistenceProperty].index;
if (needsIndexSort) {
break;
}
}


if (performLocalSort) {

if (needsIndexSort) {
me.sorters.insert(0, me.indexSorter);
}
sortCollection = new Ext.util.MixedCollection();
sortCollection.addAll(newNodes);
sortCollection.sort(me.sorters.items);
newNodes = sortCollection.items;


me.sorters.remove(me.indexSorter);
} else if (needsIndexSort) {
Ext.Array.sort(newNodes, me.sortByIndex);
}

node.set('loaded', true);
for (i = 0; i < ln; i++) {
node.appendChild(newNodes[i], undefined, true);
}

return newNodes;
}
});


With the Overwrite of the function it works perfect for me.