PDA

View Full Version : In Handle obj of panel created , but can't display



firerat
20 May 2013, 6:43 AM
Hi everyone,


// create window for add new member
createAddMemberWindow: function(a,b,c,d){
var searchWin = Ext.create('Ext.panel.Panel', { id : 'search-newuser-add',
title : 'Search Member',
frame : true,
width : 800,
height : 800,
//autoHeight: true,
autoScroll : true,
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [{
type : 'textfield',
name : 'searchNickname',
text : 'hello'
}]
}],
items : [] ,
tools : [{
type : 'refresh' ,
qtip : 'Refresh' ,
// hidden:true,
handler : function(event, toolEl, panel){}
},{
type : 'help' ,
qtip : 'Get Help' ,
handler : function(event, toolEl, panel){}
}]
});

// window didn't display
// in firebug console comand line: Ext.getCmp('search-newuser-add');
// the object has exsited ,but doesn't display
searchWin.show();
}


thanks :)

evant
20 May 2013, 4:22 PM
Because you never tell it to display anywhere.

You need to either:
a) add() it to a container
b) render() it to the DOM

skirtle
20 May 2013, 4:33 PM
Windows are implicitly rendered in the middle of the viewport when they are shown, most components (including panels) are not. I'm guessing this code is based on an example that uses an Ext.window.Window rather than an Ext.panel.Panel?

As @evant suggests, if you want to use a panel you'll need to tell it where to render.

firerat
21 May 2013, 12:58 AM
thanks.@evant (http://www.sencha.com/forum/member.php?2950-evant) @skirtle (http://www.sencha.com/forum/member.php?197255-skirtle) ~o)