Select TreeNode after Append

  1. #1

    Select TreeNode after Append

    I am trying to select a tree node after appending it from a controller. I append the node from the controller as follows...

    var oChildNode = oControl.ToExtNetNode ( );
    Ext.Net.TreePanel oTreePanel
    	= Ext.Net.X.GetCmp<Ext.Net.TreePanel>
    		( nsMyIdentify.IdMapEnum.DesignerTreePanelForProjectExplorer.ToString ( ) );
    var oNode = oTreePanel.GetNodeById ( containerId );
    oNode.AppendChild ( oChildNode );
    oNode.Expand ( true );
    I have tried to select the node both from the controller and from the client, but have not been able to do either.

    In an attempt to select the node from the controller, i do the following...

    var oSelectionModel
    	= oTreePanel.GetSelectionModel ( );
    if ( oSelectionModel != null )
    	oSelectionModel.Select ( oChildNode.NodeID );
    	var oTreeSelectionModel
    		= new Ext.Net.TreeSelectionModel
    			Mode = Ext.Net.SelectionMode.Single,
    			SelectedRecordID = oChildNode.NodeID 
    		( oTreeSelectionModel );
    the TreePanel.GetSelectionModel() is always returning null and the remainder of the code does not select the newly appended node.

    When i try from javascript, i add a listener for the "ItemAppend" function of the treepanel. The javascript function looks like this...

    this.OnItemAppendDoSelectNode = function (sender, node, index, options)
    I get the error message that the "select" is "undefined"

    I have spent all day trying to get this working but have had not luck.
  2. #2
    Client side events in JS are added like this. Your syntax isnt correct. Below is an example for a button. Please be sure to review the docs at sencha to verify your button is valid

        function (button, e) {
            alert(‘The button is clicked’);
  3. #3
    the event is firing fine...the issue is that
    does not have a "select" method as shown in examples. How do you actually select the newly appended node?
  4. #4
    the reason it doesnt work is that you are trying to work in code behind or server side code.

    either one of these should work in javascript


        callback: function (records, operation, success) {        
            var rowIndex = this.find('id', record.getId());  //where 'id': the id field of your model, record.getId() is the method automatically created by Extjs. You can replace 'id' with your unique field.. And 'this' is your store.
  5. #5
    No, I am not working in code behind and i am using a treepanel and not a grid...that is a javascript function in a standalone javascript file that i have listed above and again below...

    this.OnItemAppendDoSelectNode = function (sender, node, index, options)

Similar Threads

  1. [CLOSED] Treenode link and select
    By in forum 1.x Premium Help
    Replies: 6
    Last Post: Jan 17, 2011, 8:33 AM
  2. [CLOSED] [1.0] How to select a treenode in codebehind?
    By in forum 1.x Premium Help
    Replies: 2
    Last Post: Nov 01, 2010, 3:00 PM
  3. Replies: 0
    Last Post: Dec 10, 2009, 11:14 AM
  4. How to select TreeNode with Up/Down keys?
    By dbassett74 in forum 1.x Help
    Replies: 0
    Last Post: May 26, 2009, 7:23 PM
  5. [CLOSED] Select TreeNode Programatically
    By Ben in forum 1.x Premium Help
    Replies: 1
    Last Post: Feb 04, 2009, 9:45 AM

Tags for this Thread

Posting Permissions