/**
* Allow: Stop loading No-Leaf Node.
* Author: HACKPRO TM
* Post: -
*/
Ext.override(Ext.tree.TreeLoader, {
load: function(A, B) {
if (this.clearOnLoad) {
while (A.firstChild) {
A.removeChild(A.firstChild);
}
}
if (this.doPreload(A)) {
if (typeof B == "function") {
B();
}
} else if (this.dataUrl || this.url) {
this.requestData(A, B);
} else if (typeof B == "function") {
B();
}
}
});
Ext.override(Ext.tree.TreeNodeUI, {
updateExpandIcon : function() {
if (this.rendered) {
var n = this.node, c1, c2;
var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow";
var hasChild = n.hasChildNodes();
var cls1 = '';
if (hasChild || n.attributes.expandable || n.attributes.isFolder) {
if (n.expanded) {
cls1 = "-minus";
c1 = "x-tree-node-collapsed";
c2 = "x-tree-node-expanded";
} else {
cls1 = "-plus";
c1 = "x-tree-node-expanded";
c2 = "x-tree-node-collapsed";
}
if (this.wasLeaf) {
this.removeClass("x-tree-node-leaf");
this.wasLeaf = false;
}
if (n.attributes.isFolder && n.attributes.leaf) {
cls1 = '';
}
cls += cls1;
if (this.c1 != c1 || this.c2 != c2) {
Ext.fly(this.elNode).replaceClass(c1, c2);
this.c1 = c1; this.c2 = c2;
}
} else {
if (!this.wasLeaf) {
Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf");
delete this.c1;
delete this.c2;
this.wasLeaf = true;
}
}
var ecc = "x-tree-ec-icon " + cls;
if (this.ecc != ecc) {
this.ecNode.className = ecc;
this.ecc = ecc;
}
}
}
});
domingo, mayo 23, 2010
Prevent Loop No-Leaf Nodes in ExtJS TreeView
Using this overrider function you can stop the loading waiting loop in the TreeView.
Etiquetas:
ExtJS,
No-Leaf Nodes,
TreePanel,
TreeView
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario