Problems in communication between a Tree Panel and a Grid Panel

  1. #1

    Problems in communication between a Tree Panel and a Grid Panel

    Hi,

    I created a class that extends from Ext.Net.Container, and in that class I create 2 Ext.Net Controls, 1 Tree Panel and 1 Grid Panel. And my objective is when you click on a Tree Node gets its id and fill the Grid, I already tried various ways to get there, but all unsuccessful.

    First, I tried to attach to every TreeNode a call to a DirectMethod, and placed the DirectMethod in the class that I created, but when you run the container he doesn't find the DirectMethod, I tried also to change the DirectMethod's Namespace, but he didnt find the Namespace.

    ------------------------ CODE: ---------------------------
    private Ext.Net.TreePanel tp = new Ext.Net.TreePanel();
    private Ext.Net.GridPanel gp = new Ext.Net.GridPanel();
    
            public ExplorerView() : base()
            {
                Ext.Net.TreeNode root = new Ext.Net.TreeNode("rootNode" + this.DynamicID, "Test", Ext.Net.Icon.Folder);
    
                tp.ID = "gridID";
                tp.Root.Add(root);
    
                Ext.Net.TreeNode nodeChild = new Ext.Net.TreeNode("node" + id, name, Ext.Net.Icon.Folder);
                nodeChild.Listeners.Click.Handler = "Ext.net.DirectMethods.TreeNode_Click()";
                root.Nodes.Add(nodeChild);
            }
    
            [DirectMethod]
            public void TreeNode_Click()
            {
                // do action
            }
    OR
                nodeChild.Listeners.Click.Handler = "Test.TreeNode_Click()";
    
            [DirectMethod (Namespace="Test")]
            protected void TreeNode_Click()
            {
                // do action
            }
    
    Then I tried with DirectEvents on the TreePanel, but I have problems with the TreePanel.ID, if I don't "identify" the TreePanel, doesnt show anything, gives a javascript: sintax error.
    If I give a tp.ID = Dynamic.ID, whenever I click a node he changes the tp.ID.
    
    ------------------------ CODE: ---------------------------
    
                tp.DirectEvents.Click.Event += new Ext.Net.ComponentDirectEvent.DirectEventHandler(TreeNode_Click);
                tp.DirectEvents.Click.ExtraParams.Add(new Ext.Net.Parameter("id", this.tp.ID + ".getSelectionModel().getSelectedNode().id", ParameterMode.Raw));
    
    
    If I give a tp.ID = 'gridID' it calls TreeNode_Click(), but it doesnt update the GridPanel and I would like to create more than one instance of this container.
    
    ------------------------ CODE: ---------------------------
    public void TreeNode_Click()
            {
                JsonReader reader = new JsonReader();
                reader.IDProperty = "idjsonreader1";
                reader.Fields.Add(new RecordField("id"));
                reader.Fields.Add(new RecordField("name"));
    
                Ext.Net.Store store = new Ext.Net.Store();
                store.Reader.Add(reader);
                store.ID = "storeID";
    
                DataTable dt = new DataTable();
                dt.Columns.Add("id");
                dt.Columns.Add("name");
                DataRow dr = dt.NewRow();
                dr[0] = 1;
                dr[1] = "Lisbon";
                dt.Rows.Add(dr);
    
                DataSet ds = new DataSet();
                ds.Tables.Add(dt);
    
                store.DataSource = ds;
                store.DataBind();
                this.gp.Store.RemoveAt(0);
                this.gp.Store.Add(store);
                this.gp.Reconfigure();
                this.gp.Reload();
            }
    ----------------------------------------------------------------
    Questions:

    Could you help me find a way that I can have a DynamicID TreePanel or a way to use DirectMethods associated to the TreeNodes in the same class?
    Last edited by Daniil; Dec 13, 2010 at 2:50 PM. Reason: Please use [CODE] tags
  2. #2
    Hello,

    Joao is working with me on this issue.

    We where able to solve this problem creating an ID provider that garantees unique ids on the pages.

    This is solved. thanks.

    S้rgio
  3. #3
    Thanks for the update.
  4. #4
    Hi Guys,

    I have been trying to do a similar thing but in vain. I want to be able to call a method from a click of a node but I can't seem to get it. In my case the treepanel and the datagrid are in two different usercontrols. However, even when I try calling a directmethod on the same usercontrol of the treepanel I still can't put that to work.

    I had posted a new forum for it but I haven't heard from anyone for few days now. Here is the link to the forum:
    http://forums.ext.net/showthread.php...om-a-TreePanel

    Any help is highly appreciated.

    Thank you.

Similar Threads

  1. Replies: 1
    Last Post: Oct 26, 2012, 9:52 AM
  2. Replies: 0
    Last Post: Jan 06, 2011, 10:50 PM
  3. [CLOSED] Problems with Customised Grid Panel (0.8.3) Headers
    By vedagopal2004 in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Aug 30, 2010, 2:06 PM
  4. Update Panel from Tree Panel selection
    By Marius.Serban in forum 1.x Help
    Replies: 1
    Last Post: May 07, 2009, 7:36 AM
  5. Replies: 1
    Last Post: Jan 23, 2009, 7:43 AM

Posting Permissions