0

I have a card layout set in my app.js. here's the code;

...
launch: function() {
        var vp = Ext.create('Ext.container.Viewport', {
            layout: 'card',
            items: [
            {
                xtype: 'doctor'
            },
            {
                xtype:'nurse'
            }
            ]
        });
    }, ...

and, the first view that will load. here's the code;

Ext.define('RoyProject.view.user.Doctor', {
    extend:'Ext.form.Panel',
    alias : 'widget.doctor',
    id:'docform', 
    defaultType: 'textfield',
    items: [{       
        fieldLabel: 'Name',
        name: 'name'
        }],
    buttons: [, {
        text: 'Send',
        action:'send'        
    }]
});

Since i am using card layout in the app.js, all the first view has got stretched out, and occupies the whole screen. Therefore, to get rid of this i thought to add a Panel and within that Panel to add my view (which is RoyProject.view.user.Doctor). Can someone help me to add this view into a Panel, without changing the logic of the code :)

Illep
  • 16,375
  • 46
  • 171
  • 302

2 Answers2

1
launch: function() {
        var vp = Ext.create('Ext.container.Viewport', {
            layout: 'card',
            items: [
            {
                xtype: 'panel',
                items: { xtype: 'doctor' }
            },
            {
                xtype:'nurse'
            }
            ]
        });
    }, ...
CD..
  • 72,281
  • 25
  • 154
  • 163
0

I think you're trying to solve wrong problem. You don't need to enclose your doctor panel into another one. In general idea of nesting panels one inside another is bad...

What you need to do is to either specify fixed width for your doctor panel or play is its layout to see which one fits you better.

sha
  • 17,824
  • 5
  • 63
  • 98
  • specifying width height made no change for the stretch effect. – Illep Jul 05 '12 at 04:42
  • Well, according to @CD.. answer it works. Do you think it is the correct approach to follow ? – Illep Jul 05 '12 at 04:47
  • I really think @sha is right. nesting panels isn't a good approach, but I've just answered your question... – CD.. Jul 05 '12 at 07:26