Results 1 to 3 of 3

Thread: [Tree] - loading additional values for nodes

  1. #1
    Ext User
    Join Date
    Aug 2007
    Location
    Poznan, Poland
    Posts
    3

    Question [Tree] - loading additional values for nodes

    Hello everyone ,

    I'm using Ext tree in connection with forms, I'm able to save into database other fields than 'text', but I have problems with loading them, tree is loaded using:

    Code:
    	var treest = new Tree.TreePanel('stbody', {
    		animate: true, 
    		loader: new Tree.TreeLoader({
    			dataUrl:'action/isf/get-template.php'
    		}),
    		enableDD:true,
    		containerScroll: true
    	});
    
    	var stroot = new Tree.AsyncTreeNode({
    		text: TemplateName,
    		templateid: TemplateId,
    		templatename: TemplateName,
    		id: TemplateId,
    		draggable:false
    		});
    After saving tree I've got values in database, but when each node is generated by loader which get json array with id, text, isfvalue, leaf, cls I receive only 'text' value in form generated by double click on tree element (see code below), when I replace in json array value of text to value of isfvalue then text have it... so I need to do smth to have passed other attributes than standard like 'text', 'leaf' etc via loader... I was looking for baseAttrs... but without efect - I will be very appreciated for any hint or better example

    Code:
    	
    
    	treest.on('dblclick', function(e){
    ISFActionPERLCODE(e);
    }
    
    function ISFActionPERLCODE(e)
    	{
    		var dlg = new Ext.BasicDialog("my-dlg", {
    		    height: 350,
    		    width: 600,
    		    title: 'Configure Element',
    		    minHeight: 100,
    		    minWidth: 450,
    		    modal: true,
    		    proxyDrag: true,
    		    shadow: true
    		});
    		
    	    var simple = new Ext.form.Form({
    	        labelWidth: 111
    	    });
    	    
    	    simple.add(
    	        new Ext.form.TextField({
    	            fieldLabel: 'Action',
    	            name: 'action',
    	            disabled: 'true',
    	            value: e.text,
    	            width:350
    	        }),
    	        new Ext.form.TextArea({
    	            fieldLabel: 'Perl Code',
    	            name: 'isfvalue',
    	            value: e.isfvalue,
    	            width:450,
    	            height:150
    	        })
    	    );
    
    	    simple.addButton('Information about element configuration', ISFActionPERLCODEHelp);
    	    simple.addButton('Save', function() {
    		    	e.isfvalue		= simple.findField('isfvalue').getValue();
    		    	dlg.hide();
    	    });
    
    	
    	    simple.render(dlg.body);
    		dlg.addKeyListener(27, dlg.hide, dlg); // ESC can also close the dialog
    		dlg.show();
    	}
    Thanks in advance
    Sunnywind

  2. #2
    Ext Premium Member BernardChhun's Avatar
    Join Date
    Mar 2007
    Location
    Quebec, Canada
    Posts
    831

    Default

    just pass them in the JSON with cls, text and id dude

    Code:
    {id:"0", "text": "foo", cls : "bar", "whateverCustomProperty": "anything"}
    you may then get them using

    Code:
    var newAttr = node.attributes.whateverCustomProperty;

  3. #3
    Ext User
    Join Date
    Aug 2007
    Location
    Poznan, Poland
    Posts
    3

    Thumbs up

    Hi

    I'm back on the track after magical word "attributes" (I think it's too late now for me -> I've got 2:53 am here now)

    Many Thanks Bernard
    Last edited by sunnywind; 21 Sep 2007 at 4:54 PM. Reason: missed word

Posting Permissions

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