Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #11
    Ext User
    Join Date
    May 2007
    Posts
    40
    Vote Rating
    0
    mhubert is on a distinguished road

      0  

    Smile


    Ok -- thanks that was one thing.

    The second thing that needed changing is the function needs to be applied to the other tree
    Code:
         myfavreport.on('beforenodedrop', function(e){
          var n = e.dropNode; // the node that was dropped
       var copy = new Ext.tree.TreeNode( // copy it
                Ext.apply({}, n.attributes) 
              );
         e.dropNode = copy; // assign the copy as the new dropNode
      });
    below is a trick to prvent duplicating nodes dragged from inside the tree. This allows user sorting but prevents making additional copies
    Code:
         myfavreport.on('beforenodedrop', function(e){
          var n = e.dropNode; // the node that was dropped
       if (e.source.el !=this.el) {
           var copy = new Ext.tree.TreeNode( // copy it
                  Ext.apply({}, n.attributes) 
                );
           e.dropNode = copy; // assign the copy as the new dropNode
       }
      });
    Last edited by mhubert; 3 Jun 2007 at 8:11 PM. Reason: improvment I wanted to share w/ the community

  2. #12
    Ext JS Premium Member
    Join Date
    Sep 2007
    Posts
    1
    Vote Rating
    0
    Sridhar.Prabhakar is on a distinguished road

      0  

    Default


    while copying a node, the node is copied with the same Node ids. Which later leads o problems. Is there a way to change the node ids while creating the copy?

    I had this method implemented. but for some reason, the ids are not changed. The append string is passed as "".

    Code:
    function changeNodeIds(node, appendStr) {
    	var chldNodes;
    	alert(appendStr);
    	alert(node.id);
    	if (node.id.length == 0) {
    	    chldNodes = node.attributes.children;
    	} else {
    	    chldNodes = node.children;
    	}
    	var leafCount = 0;
    	var compCount = 0;
    	if (chldNodes != null) {
    		for (var i=0;i<chldNodes.length;i++) {
    			var chldNode = chldNodes[i];
    			if (chldNode.leaf) {
    				leafCount++;
    				chldNode.id=appendStr+alphabets.substring(leafCount-1,leafCount);
    				//alert("Leaf Node - "+chldNode.id);
    			} else {
    				compCount++;
    				if (appendStr.length == 1) {
    					chldNode.id=appendStr+(compCount);
    					//alert("Node Id - "+appendStr+(compCount));
    				} else {
    					chldNode.id=appendStr+"."+(compCount);
    					//alert("Node Id - "+appendStr+"."+(compCount));
    				}
    				changeNodeIds(chldNode, chldNode.id);
    			}
    		}
    	}
    }

  3. #13
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918
    Vote Rating
    -2
    para has a little shameless behaviour in the past

      0  

    Default


    This works for me...
    I add a clone() function to Ext.tree.TreeNode

    Code:
    Ext.override(Ext.tree.TreeNode, {
    	clone: function() {
    		var atts = this.attributes;
    		atts.id = Ext.id(null, "ynode-");
    		var clone = new Ext.tree.TreeNode(Ext.apply({}, atts));
    		clone.text = this.text;
    	
    		for(var i=0; i<this.childNodes.length; i++){
    			clone.appendChild(this.childNodes[i].clone());
    		}
    		return clone;
    	}
    });
    Then I use:
    Code:
    tree.on('beforenodedrop', function(e){
    	if(e.rawEvent.ctrlKey) {  // or whatever criteria you want to make for doing a copy instead of a move
    		e.dropNode = e.dropNode.clone();
    	}
    });

  4. #14
    Sencha User broutard's Avatar
    Join Date
    Jan 2008
    Location
    France
    Posts
    13
    Vote Rating
    0
    broutard is on a distinguished road

      0  

    Default


    Thanks, but this copy work partialy...

    When you copy a non-opening folder, you can't open the copy

    Example here : http://www.chassemy.org/sesamath/tree/two-trees.html

    nb: To prevent duplicating nodes dragged from inside the tree I have writed this :
    Code:
    tree2.on('beforenodedrop', function(e){
           if(e.source.tree.el != e.target.ownerTree.el) {
                  e.dropNode = e.dropNode.clone();
           }
    });
    Anyone can help me please ?
    Last edited by broutard; 7 Jan 2008 at 3:58 PM. Reason: adding example

  5. #15
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918
    Vote Rating
    -2
    para has a little shameless behaviour in the past

      0  

    Default


    That is because the function was made to work with TreeNode, not AsyncTreeNode.
    Here's a better version:

    Code:
    Ext.override(Ext.tree.TreeNode, {
    	clone: function() {
    		var atts = this.attributes;
    		atts.id = Ext.id(null, "ynode-");
    		if(this.childrenRendered || this.loaded || !this.attributes.children) {
    			var clone = new Ext.tree.TreeNode(Ext.apply({}, atts));
    		}
    		else {
    			var newAtts = Ext.apply({}, atts);
    			newAtts.children = this.cloneUnrenderedChildren();
    			var clone = new Ext.tree.AsyncTreeNode(newAtts);
    		}
    		newNode.text = this.text;
    		clone.text = this.text;
    	
    		for(var i=0; i<this.childNodes.length; i++){
    			clone.appendChild(this.childNodes[i].clone());
    		}
    		return clone;
    	},
    
    	cloneUnrenderedChildren: function() {
    	
    		unrenderedClone = function(n) {
    			n.id = undefined;
    			if(n.children) {
    				for(var j=0; j<n.children.length; j++) {
    					n.children[j] = unrenderedClone(n.children[j]);
    				}
    			}
    			return n;
    		};
    
    		var c = [];
    		for(var i=0; i<this.attributes.children.length; i++) {
    			c[i] = Ext.apply({}, this.attributes.children[i]);
    			c[i] = unrenderedClone(c[i]);
    		}
    	
    
    		return c;
    	},
    
    });
    I'm sure there's a more efficient way to do this though.

  6. #16
    Sencha User
    Join Date
    Nov 2008
    Posts
    50
    Vote Rating
    0
    dtondo is on a distinguished road

      0  

    Default


    good, works for me, only comment this line: //newNode.text = this.text;

    thanks

    Quote Originally Posted by para View Post
    That is because the function was made to work with TreeNode, not AsyncTreeNode.
    Here's a better version:

    Code:
    Ext.override(Ext.tree.TreeNode, {
        clone: function() {
            var atts = this.attributes;
            atts.id = Ext.id(null, "ynode-");
            if(this.childrenRendered || this.loaded || !this.attributes.children) {
                var clone = new Ext.tree.TreeNode(Ext.apply({}, atts));
            }
            else {
                var newAtts = Ext.apply({}, atts);
                newAtts.children = this.cloneUnrenderedChildren();
                var clone = new Ext.tree.AsyncTreeNode(newAtts);
            }
            newNode.text = this.text;
            clone.text = this.text;
        
            for(var i=0; i<this.childNodes.length; i++){
                clone.appendChild(this.childNodes[i].clone());
            }
            return clone;
        },
    
        cloneUnrenderedChildren: function() {
        
            unrenderedClone = function(n) {
                n.id = undefined;
                if(n.children) {
                    for(var j=0; j<n.children.length; j++) {
                        n.children[j] = unrenderedClone(n.children[j]);
                    }
                }
                return n;
            };
    
            var c = [];
            for(var i=0; i<this.attributes.children.length; i++) {
                c[i] = Ext.apply({}, this.attributes.children[i]);
                c[i] = unrenderedClone(c[i]);
            }
        
    
            return c;
        },
    
    });
    I'm sure there's a more efficient way to do this though.

  7. #17
    Sencha User
    Join Date
    Jan 2008
    Posts
    10
    Vote Rating
    1
    andregufc is on a distinguished road

      0  

    Default


    Complete solution:

    Code:
    Ext.override(Ext.tree.TreeNode, {  
         clone: function() {  
            var atts = this.attributes;  
                 if(this.childrenRendered || this.loaded || !this.attributes.children) {  
        var clone = new Ext.tree.TreeNode(Ext.apply({}, atts));  
          }  
          else {  
        var newAtts = Ext.apply({}, atts);  
        newAtts.children = this.cloneUnrenderedChildren();  
        var clone = new Ext.tree.AsyncTreeNode(newAtts);  
          }  
          clone.text = this.text;  
                  
          for(var i=0; i<this.childNodes.length; i++){  
        clone.appendChild(this.childNodes[i].clone());  
          }  
          return clone;  
        },  
          
        cloneUnrenderedChildren: function() {  
                  
          unrenderedClone = function(n) {  
            //n.id = undefined;  
            if(n.children)   
            {  
        for(var j=0; j<n.children.length; j++) {  
           n.children[j] = unrenderedClone(n.children[j]);  
        }  
            }     
            return n;  
         };  
          
         var c = [];  
        for(var i=0; i<this.attributes.children.length; i++) {  
        c[i] = Ext.apply({}, this.attributes.children[i]);  
        c[i] = unrenderedClone(c[i]);  
        }  
        return c;  
        }  
          
    }); 
    
    Ext.override(Ext.tree.TreeNode, {
         clone: function() {
        var atts = this.attributes;
                 if(this.childrenRendered || this.loaded || !this.attributes.children) {
    var clone = new Ext.tree.TreeNode(Ext.apply({}, atts));
          }
          else {
    var newAtts = Ext.apply({}, atts);
    newAtts.children = this.cloneUnrenderedChildren();
    var clone = new Ext.tree.AsyncTreeNode(newAtts);
          }
          clone.text = this.text;
    
          for(var i=0; i<this.childNodes.length; i++){
    clone.appendChild(this.childNodes[i].clone());
          }
          return clone;
        },
    
        cloneUnrenderedChildren: function() {
    
          unrenderedClone = function(n) {
    //n.id = undefined;
            if(n.children)
            {
    for(var j=0; j<n.children.length; j++) {
       n.children[j] = unrenderedClone(n.children[j]);
    }
            }
            return n;
         };
    
         var c = [];
    for(var i=0; i<this.attributes.children.length; i++) {
    c[i] = Ext.apply({}, this.attributes.children[i]);
    c[i] = unrenderedClone(c[i]);
    }
    return c;
        }
    
    });
    
    =================================================================
    
    'beforenodedrop': function(e)  
    {
        if(e.source.tree == e.target.ownerTree)  
        {  
            return true;  
        }  
        var n = e.dropNode; // the node that was dropped  
        var existNode = e.target.ownerTree.getNodeById(n.id);  
       if(e.source.tree.el != e.target.ownerTree.el&&existNode==undefined)  
       {  
            e.dropNode = n.clone(); // assign the copy as the new dropNode  
       }  
       else 
       {  
            return false;  
       }  
    }