Results 1 to 2 of 2

Thread: Help:append node to tree issue

  1. #1

    Default Help:append node to tree issue

    after append child node to a node which had not any child before,the node the style has not change what can't be expansed and collapsed .

    the red code about the insert action:
    Code:
    function prdTreeUpdatePanel(){
    	var id;
    	return new Ext.form.FieldSet({
    		id:'prdTreeFormPanel',
    		bodyStyle: 'padding:15px',
    		defaults: {
            // applied to each contained item
    			width: 230,
    			msgTarget: 'side'
    		},
    //		title:'????',
    		labelWidth: 65,
    		bodyBorder:false,
    		items:[{
    					xtype:'radiogroup',
    					fieldLabel:'??',
    					id:'prdTreeformrole',
    					vertical: false,
    					items:[
    						{boxLabel: '??',name: 'prdTreeRadio1',inputValue: 2, checked:true},
                            {boxLabel: '??', name: 'prdTreeRadio1', inputValue: 1}
    					],
    					listeners:{
    						'change':function(g,checked){
    							Ext.getCmp('prdlevelnameparent').reset();
    							Ext.getCmp('prdlevelname').reset();
    							if(checked.getGroupValue()==1){
    								Ext.getCmp('prdformbuttondelete').show();
    							}else{
    								Ext.getCmp('prdformbuttondelete').hide();
    							}
    						}
    					}
    				},{xtype:'textfield',
    //				allowBlank:false,
    				id:'prdlevelnameparent',
    				name:'prdlevelnameparent',
    				disabled:true,
    				fieldLabel:'????'
    		},{xtype:'textfield',
    //				allowBlank:false,
    				id:'prdlevelname',
    				name:'prdlevelname',
    				fieldLabel:'??'
    		},{xtype:'textfield',
    //				allowBlank:false,
    				id:'prdId',
    				hidden:true
    		}],
    		buttons:[{
    			text:'??',
    			listeners:{
    				'click':function (){
    					var id=987;
    					var pid=Ext.getCmp('prdId').getValue();
    					var name=Ext.getCmp('prdlevelname').getValue();
    					var pnode = Ext.getCmp('prdTreePanel').getNodeById(pid);
    					pnode.appendChild(new Ext.tree.TreeNode({id:id,text:name,leaf:true}));
    					pnode.expand(false);
    
    				}
    			}
    		},{
    			text:'??',
    			hidden:true,
    			id:'prdformbuttondelete',
    			listeners:{
    				'click':function (){
    					Ext.Msg.confirm('Name', 'Please enter \n your name:', function(btn, text){
    						if(btn=='yes'){
    							alert('ok');
    							Ext.getCmp('prdlevelnameparent').setValue('');
    						}
    						else alert('false');
    
    					});
    //					alert(Ext.getCmp('prdId').getValue());
    //					Ext.getCmp('prdTreePanel').getNodeById(Ext.getCmp('prdId').getValue()).destroy();	
    				}
    			}
    		}]
    		
    	});
    }
    Last edited by winds512tom; 6 Mar 2010 at 3:19 AM. Reason: show the code

  2. #2

    Default Help:append node to tree issue

    after append child node to a node which had not any child before,the node the style has not change what can't be expansed and collapsed .




    the red code about is insert action :
    Code:
    function prdTreeUpdatePanel(){
    	var id;
    	return new Ext.form.FieldSet({
    		id:'prdTreeFormPanel',
    		bodyStyle: 'padding:15px',
    		defaults: {
            // applied to each contained item
    			width: 230,
    			msgTarget: 'side'
    		},
    //		title:'????',
    		labelWidth: 65,
    		bodyBorder:false,
    		items:[{
    					xtype:'radiogroup',
    					fieldLabel:'??',
    					id:'prdTreeformrole',
    					vertical: false,
    					items:[
    						{boxLabel: '??',name: 'prdTreeRadio1',inputValue: 2, checked:true},
                            {boxLabel: '??', name: 'prdTreeRadio1', inputValue: 1}
    					],
    					listeners:{
    						'change':function(g,checked){
    							Ext.getCmp('prdlevelnameparent').reset();
    							Ext.getCmp('prdlevelname').reset();
    							if(checked.getGroupValue()==1){
    								Ext.getCmp('prdformbuttondelete').show();
    							}else{
    								Ext.getCmp('prdformbuttondelete').hide();
    							}
    						}
    					}
    				},{xtype:'textfield',
    //				allowBlank:false,
    				id:'prdlevelnameparent',
    				name:'prdlevelnameparent',
    				disabled:true,
    				fieldLabel:'????'
    		},{xtype:'textfield',
    //				allowBlank:false,
    				id:'prdlevelname',
    				name:'prdlevelname',
    				fieldLabel:'??'
    		},{xtype:'textfield',
    //				allowBlank:false,
    				id:'prdId',
    				hidden:true
    		}],
    		buttons:[{
    			text:'??',
    			listeners:{
    				'click':function (){
    					var id=987;
    					var pid=Ext.getCmp('prdId').getValue();
    					var name=Ext.getCmp('prdlevelname').getValue();
    					var pnode = Ext.getCmp('prdTreePanel').getNodeById(pid);
    					pnode.appendChild(new Ext.tree.TreeNode({id:id,text:name,leaf:true}));
    					pnode.expand(false);
    
    				}
    			}
    		},{
    			text:'??',
    			hidden:true,
    			id:'prdformbuttondelete',
    			listeners:{
    				'click':function (){
    					Ext.Msg.confirm('Name', 'Please enter \n your name:', function(btn, text){
    						if(btn=='yes'){
    							alert('ok');
    							Ext.getCmp('prdlevelnameparent').setValue('');
    						}
    						else alert('false');
    
    					});
    //					alert(Ext.getCmp('prdId').getValue());
    //					Ext.getCmp('prdTreePanel').getNodeById(Ext.getCmp('prdId').getValue()).destroy();	
    				}
    			}
    		}]
    		
    	});
    }

Posting Permissions

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