PDA

View Full Version : Nested components or component html?



hofo
7 May 2012, 10:24 AM
What's the best practice or rough guideline on when to use nested components vs. inserting structure and content in the html attribute of an umbrella container? I know that gives a lot of flexibility to be able to on the fly change the html but what about being able to insert content in a more OO manner that fits with the MVC nature of Sencha apps?

For instance, I've a conceptual component of my UI that will have text divided into three distinct pieces, all coming from different parts of my data. Am I better off to have those inserted into the html attribute of a container in different divs? Or make three nested components to hold the text items? How do I make that call? Is there a drawback to the nesting?

SebasSP
8 May 2012, 1:41 AM
There is a drawback to nesting multiple components, as TommyMaintz posted in this thread (http://www.sencha.com/forum/showthread.php?180838-Anybody-has-suggestions-for-increasing-performance-of-ST2-applications):

(...)
Another thing that we have found out to be very expensive is the nesting of many hbox and vbox layouts. This is the reason we moved our fields to use display: table, table-cell etc instead of display: -webkit-box. We can just suggest you to be careful with over nesting too many containers and layouts, and create a single template based component if you need to achieve a very complicated nested UI.
(...)