[OPEN] [#1615] [4.7.1] NodeExpand not fire

  1. #1

    [OPEN] [#1615] [4.7.1] NodeExpand not fire

    I can not trigger NodeExpand and NodeCollapse listeners, see my example.
    Thank you

    <%@ Page Language="C#" %>
    <!DOCTYPE html>
    <head runat="server">
        <link href="/resources/css/examples.css" rel="stylesheet" />
        <form runat="server">
            <ext:ResourceManager runat="server" />
                Title="My Task List"
                            <ext:Node Text="To Do" Icon="Folder" Expanded="true">
                                    <ext:Node Text="Go jogging" Leaf="true" />
                                    <ext:Node Text="Take a nap" Leaf="true" />
                                    <ext:Node Text="Clean house" Leaf="true" />
                                    <NodeCollapse Handler="alert('col');" />
                                    <NodeExpand Handler="alert('exp');" />
  2. #2
    Hello @xeo4.it!

    Thanks for the straightforward test case. This seems to be a double-left-over. Ext.NET didn't update the event name, that might have been left since the v1 era, and also from Ext JS, which didn't actually implement support for handling the event when the nodes are added directly to the tree panel.

    I see that the events are set up, but they are kept within the Ext.data.Model representation of the node, instead of being carried out as claimed in the documentation on Ext.data.NodeInterface.

    We have logged the issue under #1615 in our bugs tracking service and will post an update here as soon as we have this fixed.

    Anyway, here's how you can enable it without the use of overrides.

    1. Create the client-side methods to handle collapse/expand, and pull the listeners off the node
    function handleItemExpand(item) {
        return callInnerListener(item.data, "nodeexpand");
    function handleItemCollapse(item) {
        return callInnerListener(item.data, "nodecollapse");
    function callInnerListener(node, event_name) {
        if (Ext.isObject(node.listeners)) {
            var listener = node.listeners[event_name];
            if (Ext.isFunction(listener.fn)) {
                return listener.fn(node);
        return true;
    2. Wire up the methods above to their respective events in the TreePanel -- add this listeners block to the TreePanel itself.

        <ItemExpand Fn="handleItemExpand" />
        <ItemCollapse Fn="handleItemCollapse" />
    This way you'd have code working across versions, as far as client-side code is concerned. When server-side code (C#, Ext.NET) code comes into play, if the listeners are removed (or renamed), you'll have intellisense point the faulting code for you, then you can easily fix the client-side code as well to point to the new names.

    While we thrive to keep backwards compatibility between versions, this seems to be a feature that never actually worked in Ext.NET 4 (actually I suspect this is true since version 2!), so there's not much point in keeping the event listener names when we fix the issue. We will probably just rename them to the correct ones (this depending then of the client-side code also being fixed).

    The code above will also guarantee you can bind the listeners to the nodes individually, which seems to be your goal.

    Well, hope this helps for the time being!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi Fabricio,
    I have implemented your solution, and it works fine.
    Thank you for your time.


Similar Threads

  1. Replies: 10
    Last Post: Nov 05, 2015, 4:14 PM
  2. Replies: 5
    Last Post: Apr 09, 2015, 3:50 PM
  3. Replies: 8
    Last Post: Jul 12, 2013, 1:01 PM
  4. onevent not fire
    By vahid.ch in forum 1.x Help
    Replies: 2
    Last Post: Dec 18, 2011, 6:17 AM
  5. Don't fire events
    By yyyhxm1 in forum 1.x Help
    Replies: 0
    Last Post: Jun 03, 2010, 2:18 AM

Posting Permissions