Results 1 to 6 of 6

Thread: Click event on Tree Panel +/-

  1. #1

    Question Click event on Tree Panel +/-

    I have a tree panel that loads something into another content panel at each node level. I have event listeners on my tree for click, expand and collapse. The expand and collapse listeners call a loader which loads my content into the content panel. The click listener only calls the loader if the node is a leaf.

    The problem is that collapsing all fires the loader for each subnode leaving the content panel showing the details for the last node in the path.

    If I click on the folder icon or folder name, rather than the +/-, I can capture the node id and handle the collapsing and load the correct data for that node. If I click on the +/- I can't.

    Is there anyway of disabling the +/- functionallity so that the tree expands or collapses only when a folder icon or folder name is clicked?

    Or, is there anyway of handling the click event of the +/-?

  2. #2
    Sencha Premium Member
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,675

    Default

    You think too complicate. How do you collapse all? I guess with an own action. So set a var that indicates you do a collapse all.

  3. #3

    Default

    Sorry I wasn't very clear. When I said "collapsing all" I meant collapsing all child nodes from that point.

    So My code does this:
    Code:
    listeners       : {
       collapseNode : function(n){
          n.collapseChildNodes(true);
     
          //My function call to load the content panel
          loadContentPanel(n.id);
       }
    }
    So when I collapse a node I want the content panel to display that node's content not the child node's. As you can see this will always load the last child node's content. If I add a click listener I can capture the node id that is clicked in variable and test it in an if statement from the collapse listener. The problem is when the node's toggle +/- image is clicked, it doesn't fire the click listener.

    If you consider each node in the tree as a row, you can click anywhere along that row except for over the +/- toggle image and it will fire the click event. The same applies if you set "useArrows : true". You can click on the folder image, the node text and the white space to the right or left (of an expanded node) and it will fire the click event but not when the node toggle image is clicked.

    Has anyone else had this problem? Is it possibly a bug?

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,675

    Default

    why do you show content on collapse? The normal way is to show this on node click. Your way is a bit strange from usability.
    This way you also could expand subnodes on node click without any problems.

  5. #5

    Default

    I am developing a catalogue and the items in the content panel reflect the nodes in the tab panel. The user can click either the node or the icon in the content panel to navigate the tree. That is why I am using the expand and collapse listeners. If you re-read my post you will also see that the click listener is not fired when a user clicks on the +/- toggle so I am having to use the expand collapse listeners.

  6. #6
    Ext JS Premium Member
    Join Date
    Jan 2010
    Posts
    13

    Default

    Is this possibly a place where you would want to use suspendEvents and resumeEvents before and after your collapseChildNodes call ? I have never used this but reading the documentation I would give this a try if I had that same problem.

Similar Threads

  1. Help with tree click event after it is loaded into panel
    By superFly77 in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 1 May 2009, 7:06 AM
  2. Load tree on click event(Urgent)
    By gopal_lal in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 3 Mar 2009, 4:37 AM
  3. How to fire 'click' event on tree node?
    By incaic in forum Sencha Ext JS Q&A
    Replies: 2
    Last Post: 7 Jul 2008, 8:31 AM
  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. Column Tree click event
    By jpderooy in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 25 Jan 2008, 1:49 AM

Posting Permissions

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