jQWidgets Forums
jQuery UI Widgets › Forums › Navigation › Expander › Problems with Expander Height
This topic contains 4 replies, has 2 voices, and was last updated by stephan 11 years, 11 months ago.
-
Author
-
Hi,
When creating an expander and then adding it to the DOM the expander has an incorrect height, ie. it is too high bei some 12 pixels.
This fiddle demonstrates the problem:
http://jsfiddle.net/_stephan_/qVW7Y/5/The expander overlaps with the text that follows th expander element.
Regards,
StephanHi,
The widgets is incorrectly initialized. It is expected to initialize a widget from an existing DOM element. Otherwise the jQuery’s width() and height() functions will not return correct results.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Well, I read as a “best practice” that adding elements to the DOm as late as possible is a great perfromance enhancement for web applications. If you add to the DOM early on, then modify the added element continuously, you get DOM re-rendering overhead for each single modification to the DOM.
In my case I create dynamically a very complex content for the expander. In fact an entire dialog representation goes into the expander and gets created control by control from runtime data. Thus I want to avoid modifying the DOM hundreds of time, by first constructing the expander with content, and THEN adding it to the DOM when all content is in there. Additionally if lots of small content gets added dynamically this process actually becomes visible due to the continuous re-rendering of the DOM by the browser.
Is there a chance to avoid the continuous DOM re-rendering using jqxWidgets ? Otherwise I’ll have to update my application logic and live with the overhead and the side effects.
Regards,
StephanHi,
What I say is that the widget should be initialized from an element added to the DOM. It does not matter when you add the HTML element, just add the initialization code after you add the HTML Element to the DOM, not before it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi,
I am already in the process of restructuring my app to comply with the peculiarities of jQWidgets.
That said I would consider it to be rather pointless to call jqWidgets initializers after creating just the HTML as one block and adding it. After all: what do the jQWidgets initializers do ? They perform more or less extensive DOM object modifications by adding in extra “div”s, setting properties, etc. In other words: calling the jQWidgets initializers again causes a larger amount of DOM modifications to occur. As stated before: each single DOM modification causes the browser to re-render the entire HTML …. which is what I attempted to prevent in the first place.
Regards,
Stephan -
AuthorPosts
You must be logged in to reply to this topic.