Problems in communication between a Tree Panel and a Grid Panel

Threaded View

Previous Post Previous Post   Next Post Next Post
  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 1:50 PM. Reason: Please use [CODE] tags

Similar Threads

  1. Replies: 1
    Last Post: Oct 26, 2012, 8:52 AM
  2. Replies: 0
    Last Post: Jan 06, 2011, 9: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, 1:06 PM
  4. Update Panel from Tree Panel selection
    By Marius.Serban in forum 1.x Help
    Replies: 1
    Last Post: May 07, 2009, 6:36 AM
  5. Replies: 1
    Last Post: Jan 23, 2009, 6:43 AM

Posting Permissions