[CLOSED] Bug on plugins?

  1. #1

    [CLOSED] Bug on plugins?

    I'm trying to create a plugin to encapsulate some javascript code for specific components (instead of inherit the whole component). So far, it works fine, but, when I tried to inherit from an existing plugin, MY init function is not called anymore.

    Ex.:
    public sealed class OrganogramNodeTreeViewDragDropPlugin : TreeViewDragDrop
    {
    
        public override string InstanceOf
        {
            get { return "TMC.ux.OrganogramNodeTreeViewDragDropPlugin"; }
        }
    
    }
    This doesn't work (the init method of my script is never called). The DragNDrop works fine in this case.

    public sealed class OrganogramNodeTreeViewDragDropPlugin : Plugin
    {
    
        public override string InstanceOf
        {
            get { return "TMC.ux.OrganogramNodeTreeViewDragDropPlugin"; }
        }
    
    }
    This works fine (my plugin is initialized). Notice that I just changed the inheritance part. No scripts were changed.

    In both cases, my script inherits from the correct base plugin:

    Ext.define("TMC.ux.OrganogramNodeTreeViewDragDropPlugin",
        {
            extend: "Ext.tree.plugin.TreeViewDragDrop",
            alias: "plugin.tmcorganogramnodetreeviewdragdrop",
            treeView: null,
            
            init: function (treeView)
            {
                debugger;
                console.dir(arguments);
                this.callParent(arguments);
                this.treeView = treeView;
            }
        });
    What I want to do is create a specific plugin that could handle some server-side code on initialization, but inheriting from an existing plugin:

        public OrganogramNodeTreeViewDragDropPlugin()
        {
            AllowLeafDrop = true;
            AppendOnly = true;
            DDGroup = "OrganogramNodesEditor";
            DragGroup = "OrganogramNodesEditor";
            DropGroup = "OrganogramNodesEditor";
            NodeHighlightOnDrop = true;
            NodeHighlightOnRepair = true;
        }
    But I can't, because server side plugins works, but doesn't trigger the init method of MY script when inheriting anything but Plugin class =\
    Last edited by Daniil; Apr 30, 2013 at 4:13 AM. Reason: [CLOSED]
  2. #2
    Hi @Periscope,

    It appears to be working for me. Here is a test case. Could you provide your test case?

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">    
        public sealed class TestPlugin : Plugin
        {
            public override string InstanceOf
            {
                get { return "Ext.tree.plugin.TestPlugin"; }
            }
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
            this.TreeView1.Plugins.Add(new TestPlugin());
        }
    
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            Ext.define("Ext.tree.plugin.TestPlugin", {
                extend: "Ext.tree.plugin.TreeViewDragDrop",
                alias: "plugin.testplugin",
    
                init: function () {
                    alert("I am within the init function")
                    this.callParent(arguments);
                }
            });
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TreePanel runat="server">
                <Root>
                    <ext:Node Text="Root (level 0)" Expanded="true">
                        <Children>
                            <ext:Node Text="Node1 (level 1)" Expanded="true">
                                <Children>
                                    <ext:Node Text="Node1 (level 2)" Leaf="true" />
                                </Children>
                            </ext:Node>
                        </Children>
                    </ext:Node>
                </Root>
                <View>
                    <ext:TreeView ID="TreeView1" runat="server" />
                </View>
            </ext:TreePanel>
        </form>
    </body>
    </html>
    By the way, you might need to override a Plugin's PType property as well.
  3. #3
    My test case is the same of yours, just change the following line and the alert isn't displayed anymore:

    public sealed class TestPlugin : Ext.Net.TreeViewDragDrop
  4. #4
    Well, as I said, you should override the PType property as well.

    Example
    public sealed class TestPlugin : Ext.Net.TreeViewDragDrop
    {
        public override string InstanceOf
        {
            get { return "Ext.tree.plugin.TestPlugin"; }
        }
    
        public override string PType
        {
            get 
            { 
                    return "testplugin";
            }
        }
    }

Similar Threads

  1. [CLOSED] Useful Browser Extensions/Plugins
    By cwolcott in forum Open Discussions
    Replies: 4
    Last Post: Mar 25, 2013, 8:37 AM
  2. Replies: 2
    Last Post: Aug 28, 2012, 5:51 PM
  3. HtmlEditor Plugins
    By corsaronero in forum 1.x Help
    Replies: 1
    Last Post: Oct 09, 2011, 7:07 PM
  4. Download MonthPicker Plugins
    By initial_b in forum 1.x Help
    Replies: 0
    Last Post: Aug 18, 2011, 11:12 AM
  5. How to add Plugins?
    By jxvalenz in forum 1.x Help
    Replies: 1
    Last Post: Jul 05, 2008, 4:44 AM

Tags for this Thread

Posting Permissions