PDA

View Full Version : including lots of text/html in extjs pages



carlton.draught
27 Jun 2012, 11:37 PM
Hi there,

I have what seems to be a very simple problem but i can't find a solution.

I have an ExtJS4 MVC app that includes a reasonable amount of HTML (columns of text / inline images etc), i.e. the site uses viewports and panels but not many widgets/forms etc.

I am trying to work out the best way to import these blocks of HTML into my app, ideally they should be stored separately (not in the javascript) i think.

currently to display my HTML i use a panel like this:



var items = [{
xtype: 'panel',
bodyCls: 'text-panel',
minHeight: 500,
autoLoad: 'app/htmls/home.html'
}];


which gives the desired effect, but it seems clunky to have the page requested 'on the fly' like this instead of loaded at the beginning, event with forcing that page to be cached for subsequent requests.also the size calculation of the panel is awkard, and i have to redo the layout after it loads.

I have tried including the text in DIVs in the index.html and using contentEl but it doesn't always work, with the divs disapearing when the viewport is changed.

so my question is: what is the recommended way in ExtJS for importing large blocks of static text into Panels at load time ?

thanks for any ideas,

-ivan

scottmartin
28 Jun 2012, 11:34 AM
Have a look at our MCV feedviewer app. It displays HTML in the lower region:
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/app/feed-viewer/feed-viewer.html

Scott.

carlton.draught
28 Jun 2012, 11:20 PM
Hi Scott, thanks for your reply.

ok so if i understand correctly the recommended way to include medium-large quantities of 'static' text in our applications is to create a store with page text stored in records ? and using the feedviewer example i can see how to use the CDATA to allow for html markup. and the store can load once at startup to keep it quick.

i guess that will work, but i can't help but feel that its a complex approach for such a basic requirement.

thanks for your response though,. we will proceeed like that.

-i