1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    303
    Vote Rating
    0
    flamant is on a distinguished road

      0  

    Default cannot fire a "click" event in a tree

    cannot fire a "click" event in a tree


    Hi,
    I have a treepanel in my left panel :
    Code:
    title: 'navigation',
    region:'west',
    width: 175,
    minSize: 100,
    maxSize: 250,
    layout: 'accordion',
    items:[
              {
            title: 'etudes',
            iconCls: 'studiesIcon',
            items: [new Tree.TreePanel({
                id: 'metadataTreeView',
                useArrows: true,
                autoScroll: false,
                animate: true,
                enableDD: true,
                border: false,
                dataUrl: './getStudyList.htm?targetDivId=metadataContent',
                root: {
                    nodeType: 'async',
                    text: 'etudes',
                    draggable: false,
                    id: 'studyRoot',
                                    cls: 'metadataTreeViewClass',
                    expand: true,
                    subEntityName: 'Study',
                    create: true,
                    allowedActions: {}
                    },
                listeners: {
                        click: function(node) {
                            selectedMetadataNode = node;
                                                    alert('ca passe 2')
                            updateActionsAvailability(.....);
                            doClickAction(....);
                            },
                        contextmenu: function(node){
                            selectedMetadataNode = node;
                            updateActionsAvailability(....);
                                    }
                           }

    in my center panel, I try to fire the event "click" of my treeview :
    Code:
    function doSubmitAction(form, gridsToUpdate, actionUrl, postAction, waitingMessage, failureMessage, successMessage, statusBar, tree, mode, module, ArgAction, node){
            
            form.submit({
                url:actionUrl,
                waitMsg: waitingMessage,
                success: function(form, action){
                                     var resultingId = action.response.responseXML.childNodes[0].childNodes[3].textContent;
                                      tree.reloadAndApplyState();
                                      if (ArgAction == 'insert') {
                                              var nodeToClick = tree.getNodeById(node.attributes['subPath']+resultingId);
                                             alert('ca passe1 node.attributes-subPath-resultingId='+node.attributes['subPath']+resultingId);
                                              /*nodeToClick.select();
                                               alert('ca passe 10');  */
                                              var test = tree.fireEvent("click",nodeToClick);
                                               alert('ca passe 11 firevent='+test);
                                        } else {
                                                ......
                                         }
                            },
                failure: function (result, request) {
                            updateStatusBar(...);
                            Ext.Msg.alert(...);
                            }
            })
    }
    In case of success in the function "doSubmitAction" and in the case (ArgAction == 'insert') I print "ca passe1" correctly but afterwards it doesn't want to execute neither "nodeToClick.select();" nor "var test = tree.fireEvent("click",nodeToClick);"
    Does anybody has an idea ? Thanks in advance

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    why try to synthesize a click event? Why not just select the node!?

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I thought that, but then I thought maybe there will be an unknown, arbitrary number of listeners which will still need to know.

    Firing an event should work. The OP just needs to get his act together and debug it. Step into the fireEvent call and find out why it's not doing what he hoped it would.

    It's what we all have to do when just staring at the code fails!

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I doubt the OP is aware on how to debug .

    He's using alerts.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Then his project will overrun, and might even fail.

  6. #6
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I couldn't imagine a life w/out at least firebug

Similar Threads

  1. Replies: 1
    Last Post: 31 Aug 2009, 6:04 PM
  2. Now "right-click" or "contextmenu" event on Button?
    By dbassett74 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 11 Jul 2009, 10:19 AM
  3. Fire a Tree "SelectionChange" event when clicking the currently selected item
    By Cputerace in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 27 Feb 2009, 8:59 AM
  4. [2.1][FIXED] Store.loadData does not fire "load" event
    By mcurrey in forum Ext 2.x: Bugs
    Replies: 4
    Last Post: 22 Jul 2008, 11:25 AM
  5. Ext.data.HttpProxy does not fire the "load" event.
    By Animal in forum Ext 1.x: Bugs
    Replies: 1
    Last Post: 12 Apr 2007, 4:00 AM

Thread Participants: 2