ExtJS element for component

I want to take an ExtJS element (div) extracted from the DOM selector and convert it to an ExtJS component (panel). How can i do this? Thank.

+5
source share
1 answer

You want to use the configuration contentEl. It puts what is in the div into the panel.

<html>
  <head>
    <link rel="stylesheet" href="ext-3.1.1/resources/css/ext-all.css" />
    <script src="ext-3.1.1/adapter/ext/ext-base.js"></script>
    <script src="ext-3.1.1/ext-all-debug.js"></script>
    <script>
      Ext.BLANK_IMAGE_URL = 'ext-3.1.1/resources/images/default/s.gif';
      Ext.onReady(function(){
        var viewport = new Ext.Viewport({
          items: [{
            title: 'About Us',
            width: 200,
            height: 200,
            contentEl: 'about_us'
          }]
        });
      });
    </script>
  </head>
  <body>
    <div id="about_us">We are a great team to work with!</div>
  </body>
</html>

div content inside a panel

+6
source

All Articles