Hi Werner,

here's a solution I came up with a while ago. Might not be the most 
elegant, but it works:

       // scroll to to the last entry if a message is added
       htmlEmbed.addListener("changeHtml", function(ev) {
         var element = this.getContentElement().getDomElement();
         // need to use a timeout to make sure the HTML is updated
         window.setTimeout(function() {
           var lastChildIndex = element.childNodes.length - 1;
           if (lastChildIndex > 0) {
             var lastChild = element.childNodes[lastChildIndex];
             qx.bom.element.Scroll.intoViewY(lastChild);
           }
         }, 0);
       });

As you can see, the trick is to do the scrolling asynchronously so the 
browser can update the DOM first.

Regards,
Daniel

Werner Thie schrieb:
> Hi all
> 
> I'm sure missing out on a very simple and obvious feature:
> 
> Appending to a qx.ui.embed.Html element like
> 
> var prev = elem.getHtml();
> orev += '<br/>another line';
> elem.setHtml(prev);
> 
> elem.keepScrolledToTheVeryBottom();     //????
> 
> I tried scrolling events, sending events and didn't make progress at all.
> 
> TIA, Werner
> 
> 
> ------------------------------------------------------------------------------
> This SF Dev2Dev email is sponsored by:
> 
> WikiLeaks The End of the Free Internet
> http://p.sf.net/sfu/therealnews-com
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 

------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:

WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to