I'm new to Ext - please forgive me for my ignorance. I've spent hours trying to figure this out, including looking at the example code and the documentation (docs/output/Ext.Panel.html) and can't figure out an easy way to load existing div content into a panel without duplicating it.
I want to take something like this:
Code:
<html>
<head>
...includes left out for simplicity
<script type="text/javascript" >
Ext.onReady(function(){
...
});
</script>
</head>
<body>
<div id="panel_content">I want to display everything in this div as a panel</div>
</body></html>
and display #panel_content within a panel. Here's what I started with, straight from the sample with the exception of the html config option:
Code:
var p1 = new Ext.Panel({
title: 'Filter Options',
collapsible:true,
renderTo: 'panel_content',
width:400,
html: Ext.get('panel_content').dom.innerHTML
});
This displays a duplicate copy of #panel_content within a panel at the bottom of the existing content. I have tried other combinations using the contentEl: config option and using the render() method instead of the renderTo: option but nothing I've tried will gracefully replace #panel_content with the panel. I can load the innerHTML from my div into a string, set the innerHTML to '' then set the html config option to my string but that seems like a hack. There must be something simple that I'm overlooking here. Any help would be appreciated.