View Full Version : Problems with Card Layout

Stephan Schrade
7 Jul 2010, 8:47 AM
I'm trying to use the card layout to switch between two panels.
The samples work very good.
But I don't want to put all my config code etc. in the item part.
Therefore I created a var testpanel = new Ext.Panel({.......

I do this always with Ext JS but with touch it doesn't work.
Am I wrong?

Here is the code:

icon: 'icon.png',
glossOnIcon: false,
onReady: function() {

var testpanel = new Ext.Panel ({
layout: 'fit',
items: {
titel: 'FitPanel',
html: 'Fit Panel',
border: false

// create Main Panel
var panel_gesamt = new Ext.Panel({
fullscreen: true,
layout: 'card',
activeItem: 0,
title: 'title area',
items: [{
id: 'intro',
html: 'panel 1'
}, {
testpanel /* --> here I get the error */
TIA Stephan

7 Jul 2010, 8:52 AM
It's not valid JS syntax, you're doing:

items: [{
}, {testPanel}]

It should be:

items: [{
}, testPanel]

Stephan Schrade
7 Jul 2010, 8:59 AM
Oh no, I'm so stupid.
Thanks very much.
In my ExtJS Code (where it works) I don't use the {'s :-D

Thanks, Stephan