tags:

views:

112

answers:

2
add({
     title: args.node.id,
     iconCls: 'tabs',
     items: [{html: '<code class="prettyprint"><?php\necho \'Hello World!\';</code>', width: '100%', hieght: '100%', plain: true}],
     closable: true
}).show();

I am running the above method on Ext.TabPanel and it is returning '' as the html...

If I do

<code class="prettyprint"><html><head><title>Whatever</title></head><body.The body!</body></html></code>

It just renders The body!... how can I get it to display the source code??

Many thanks...

+1  A: 

You need to transform all the < and > into &lt; and &gt;.

webdestroya
A: 

A better approach would be to include the markup in the HTML of your page, wrapped in a div with an id, then pull that into your Panel via the contentEl config using that id. Any sort of nontrivial HTML content will very quickly devolve into a world of pain if you try to use the html config for this. HTML-encoding, line breaks, indenting, etc. -- just format the HTML as it's intended to be done -- in HTML.

bmoeskau
Many thanks for the suggestion. However the content is being loaded via AJAX as a string.
Simon
In that case I would recommend using the autoLoad config as shown in the second example on this page: http://www.extjs.com/deploy/dev/examples/tabs/tabs.htmlAs you can see if you look at the code, the contents loaded via autoLoad (internally via UpdateManager) are automatically HTML-encoded.
bmoeskau