Results 1 to 3 of 3

Thread: Determine if treenode exists?

  1. #1

    Join Date
    Jan 2008
    Location
    Levittown, PA
    Posts
    362

    Default Determine if treenode exists?

    I return the following JSON to build a tree. I don't always send the 'admin' node back. How can I determine if that 'admin' node exists or is returned? I've seen some solutions with overrides online, but I don't understand them!

    Based on whether or not the 'admin' portion of the tree is populated I want to enable/disable features.

    TIA.



    Code:
    [{
        text:'Available Reports',
        id:'available',
        expanded: true,
        children:[{      
            	text:'All Visitations',
            	id:'visitation-all',
            	disabled: false,
    		iconCls:'icon-grid',
            	leaf:true
    	     }, {
    		text:'List for Alphonse',
            	id:'visitation-CHO',
            	disabled: false,
    		iconCls:'icon-grid',
            	leaf:true			
    	     }, {
    		text:'List for Jeanine',
            	id:'visitation-JRM',
            	disabled: false,
    		iconCls:'icon-grid',
            	leaf:true			
    	     }, {
    		text:'List for Manuel ',
            	id:'visitation-MCH',
            	disabled: false,
    		iconCls:'icon-grid',
            	leaf:true			
    	     }, {
    		text:'List for Mike ',
            	id:'visitation-MHA',
            	disabled: false,
    		iconCls:'icon-grid',
            	leaf:true			
    	     }, {
    		text:'List for Vladimir',
            	id:'visitation-VLA',
            	disabled: false,
    		iconCls:'icon-grid',
            	leaf:true			
    	     }]
    },{
        text:'Maintenance Options',
        expanded: true,
        id:'admin',
        children:[{
            text:'User Maintenance',
            id:'user-maintenance',
            disabled: false,
    	iconCls:'icon-grid',
            leaf:true
    		}]	     
    }]

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    Have you tried doing a getNodeById('admin') on the tree panel? Or you can do a findChild('id', 'admin') on a parent node.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3

    Join Date
    Jan 2008
    Location
    Levittown, PA
    Posts
    362

    Default

    Yes, this worked for me. Thank you.

    Code:
    if (treePanelExt.getNodeById('admin'))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •