Results 1 to 3 of 3

Thread: How to trigger a double click event to tree nodes

  1. #1

    Question How to trigger a double click event to tree nodes

    I came across a problem when I was trying to trigger a double click event to tree nodes. The code below is someones online, creating a tree when loading Google Map file in KML format. What I would like to do is to double click a tree node and some function can be trigged. Please give me the exact solution and code as I am a beginner of ExtJs. I appreciate your help in advance.

    Code:
       // Create KML tree (called by above function)
        treeNodeFromKml: function(kmlObject){
            var result = this.createKmlTreeNode(kmlObject);
         if(kmlObject.getFeatures().hasChildNodes()) {
          var subNodes = kmlObject.getFeatures().getChildNodes();
          for(var i = 0; i < subNodes.getLength(); i++) {
                var subNode = subNodes.item(i);
                switch(subNode.getType()) {
               case 'KmlFolder' :
                     var node = this.treeNodeFromKml(subNode); // Recursion
                break;
                 default:
             var node = this.createKmlTreeNode(subNode);
                  break;
                }
                result.appendChild(node);
               }
            }
         return result;
        },
        // Create KML tree node (called by above function)
        createKmlTreeNode: function(kmlEl){
         var node = new Ext.tree.TreeNode({
          text: kmlEl.getName(),
          checked: (kmlEl.getType() != 'KmlPlacemark' ? (kmlEl.getVisibility() ? true : false) : null),
          expanded: (kmlEl.getOpen() ? true : false),
          iconCls: kmlEl.getType(),
          kml: kmlEl
         });
         return node;
        }

  2. #2

    Default

    Code:
    // Create KML tree (called by above function)
    treeNodeFromKml: function (kmlObject) {
        var result = this.createKmlTreeNode(kmlObject);
        if (kmlObject.getFeatures().hasChildNodes()) {
            var subNodes = kmlObject.getFeatures().getChildNodes();
            for (var i = 0; i < subNodes.getLength(); i++) {
                var subNode = subNodes.item(i);
                switch (subNode.getType()) {
                case 'KmlFolder':
                    var node = this.treeNodeFromKml(subNode); // Recursion
                    break;
                default:
                    var node = this.createKmlTreeNode(subNode);
                    break;
                }
                node.on('dblclick', someFn, someFnScope);
                result.appendChild(node);
            }
        }
        return result;
    },
    // Create KML tree node (called by above function)
    createKmlTreeNode: function (kmlEl) {
        var node = new Ext.tree.TreeNode({
            text: kmlEl.getName(),
            checked: (kmlEl.getType() != 'KmlPlacemark' ? (kmlEl.getVisibility() ? true : false) : null),
            expanded: (kmlEl.getOpen() ? true : false),
            iconCls: kmlEl.getType(),
            kml: kmlEl
        });
        return node;
    }

  3. #3

    Default

    Thanks a lot. It is working perfectly

Similar Threads

  1. Double Click Event
    By arun57 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 4 Feb 2009, 1:20 AM
  2. Click and double click event on a grid row
    By davidallen in forum Sencha Ext JS Q&A
    Replies: 11
    Last Post: 20 May 2008, 10:50 AM
  3. Double click breaks the click event for entire application
    By s.e.todd in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 16 Apr 2008, 12:36 PM
  4. Adding click event to tree nodes
    By neenhouse in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 14 Mar 2008, 1:24 PM
  5. Question on double click and single click event handlers within grid
    By NotChris in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 27 Feb 2008, 11:51 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •