Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: Help

Reply
 
Thread Tools
  #1  
Old 02-08-2008, 06:04 AM
nutflakes nutflakes is offline
Ext User
 
Join Date: Jan 2008
Posts: 14
nutflakes is on a distinguished road
Question components missing after replacing panel contents

Hi,

I'm trying to implement a dynamic layout.
So I defined a borderlayout with a basic toolbar in the north panel.
On click to a navigation item the content of the center panel is replaced.
But first all existing components are removed.

My problem is now that I want to load the components via function.

Here is my source

[CODE]
Ext.namespace('myNamespace');

myNamespace.layout = function() {
var titleSelect;

var loadTitleSelect = function() {
if(!titleSelect) {
// erzeugen
titleSelect = new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({
fields: ['id', 'salutation'],
forceSelection: true,
data : [
[1, 'Dr.'],
[2, 'Professor']
]
}),
fieldLabel: 'Titel',
displayField:'salutation',
typeAhead: false,
mode: 'local',
editable: false,
triggerAction: 'all',
emptyText:'bitte w
Attached Images
File Type: jpg screen1.jpg (21.3 KB, 26 views)
File Type: jpg screen2.jpg (22.8 KB, 12 views)
Reply With Quote
  #2  
Old 02-08-2008, 11:42 AM
devnull devnull is offline
Ext JS - Support Team
 
Join Date: Jul 2007
Posts: 3,128
devnull is on a distinguished road
Default

I am guessing that the var titleSelect is not working as you think it will.
When the form is replaced, the combo is destroyed, but the var will still be defined (but empty).
Why not just put the combobox in with the rest of the form constructor config?
Reply With Quote
  #3  
Old 02-10-2008, 07:52 AM
nutflakes nutflakes is offline
Ext User
 
Join Date: Jan 2008
Posts: 14
nutflakes is on a distinguished road
Default

thanks for your reply!

I know the way you suggest is working but the code will become very unclear and this is what I wanted to provide.
Hmm as this will be a prototype only I will put the components in.

nutflakes
Reply With Quote
  #4  
Old 02-11-2008, 12:58 PM
devnull devnull is offline
Ext JS - Support Team
 
Join Date: Jul 2007
Posts: 3,128
devnull is on a distinguished road
Default

Actually I think the code is much harder to read when the layout is broken up into multiple sections. In my apps I try to construct the layout using as few objects as possible.
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 01:05 AM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.