0

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

5
  • Post a full example, isolated snippets of code where you don't even show the container aren't useful. Commented Jan 23, 2014 at 13:23
  • I cannot even make a fiddle: Stuck here: fiddle.sencha.com/#fiddle/2t6 Commented Jan 23, 2014 at 13:30
  • 1
    Because the code has syntax errors in it... Commented Jan 23, 2014 at 13:34
  • Sorry but I don't see any! Commented Jan 23, 2014 at 13:37
  • 1
    Take the time to format your code properly, it will become immediately obvious. Or just drop that code into any page. Commented Jan 23, 2014 at 13:38

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Usually you shouldn't put height and width into the style, but as configuration of the container itself, because most containers do calculate the height and width dynamically and set thus override the element styles. Though a dynamic layout like fit is more suitable for containers, so they take the size of it's content (or it's parent when parent uses fit)
Sorry but still nothing!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.