View Full Version : Best way to include bunch of small, static html fragments?

23 Jul 2010, 9:24 AM
Hi there...brand new to Sencha/ExtJS, digging it so far (have been a Flash/Flex app developer for a decade).

I have a set of about 20 or so static html fragments which represent the 'body copy' of each page of a site. Most of these are relatively small, each one being a single div of probably no more than 50 lines of html code.

At the moment, I am hardcoding the html as a string in the 'html' property of a config object of a custom panel, but I'm sure there's a more appropriate solution. I was thinking about just adding them as hidden divs on the index page, and then using them as the value of the 'contentEl' parameter when creating the new panels, but after reading the docs that doesn't sound like the way I'd want to go either.

Any help is appreciated, thanks.

23 Jul 2010, 9:35 AM
I've been using AJAX for something similar and the loading speeds seem fine (especially with just text)

23 Jul 2010, 10:27 AM
The response from Evant in this post may help: http://www.sencha.com/forum/showthread.php?104157-Simple-html-version-of-carousel

I am trying to keep the html from the javascript mostly for updating purposes with my project, as well as allowing users to easily change the text and layout to their own purposes (I'm trying to build a magazine publishing 'engine' with Sencha)

Because of the way Sencha works, the elements in the html are not displayed until they are brought forth in the javascript file. You may see them displayed while the site is being 'built', but I am sure there is a way of blocking that process which I have not yet discovered.

23 Jul 2010, 1:18 PM
Look into using the template feature to specify a layout and populate it with data from objects, rather than building the string directly into the html property.

23 Jul 2010, 2:11 PM
Hmmm...I think i get what you mean, but I always picture templates as being just for Lists. Can you point me in the right direction for some more info?