Jacob
Jacob

Reputation: 4031

Ext JS add container to container

I am having difficulties with very strange problem. My Dynamically created container doesn't get drawn into an exsisting one.

var patientContainer = new Ext.container.Container(id:'patientContainer'+ rec.data.patientId, style: {height: '500px', width:'500px',
                                                   borderColor:'#000000', borderStyle:'solid',
                                                   borderWidth:'1px'}});

//exsisting container

cont.add(patientContainer);
cont.doLayout();

The value fr container id is present. I have also checked there is nothing wrong with the exsisting container cont Am I missing something?

UPDATE: using this code changes nothing

      var patientContainer = Ext.create('Ext.container.Container', {
                        id:'patientContainer'+ rec.data.patientId,
                            width:400,
                            height:400,                                    
                               style: {
                                borderColor:'#000000',
                                borderStyle:'solid',
                            borderWidth:'1px'
                                    }

                    });

UPDATE: Below is a screenshot of the console output. First one is the nely created container and the second one is the exsisting one enter image description here

Upvotes: 0

Views: 223

Answers (1)

Tseng
Tseng

Reputation: 64307

ExtJS Configurations are passed as object, not as parameters.

var patientContainer = new Ext.container.Container({
    id:'patientContainer'+ rec.data.patientId,
    height: '500px',
    width:'500px',
    style: {
        borderColor:'#000000',
        borderStyle:'solid',
        borderWidth:'1px'
    }
});

Notice the additional { at the beginning and end. Also it's recommend to use Ext.create('Ext.container.Container', { ... }); because it takes care of class loading, which new key word doesn't.

Upvotes: 1

Related Questions