Page 1 of 1

Html Area Scrollbar

PostPosted: Mon Sep 15, 2014 2:35 pm
by Janssenjos
Hi!

I have a HTML_Area which I show in the webclient. It has a dataprovider, logText, which I update with the work that has been done.
Now how I would like the vertical scrollbar to behave, is that it scrolls to the bottom, when I update the logtText dataprovider. So you always see the last line that is added.

But I just can't figure out how to do that. I tried to set the Y scroll to an high number, but it just stays on top every time.

Does anyone knows how this works?

Thanks!

Re: Html Area Scrollbar

PostPosted: Thu Sep 25, 2014 9:28 am
by Janssenjos
So no one? :(

Bummer...

Re: Html Area Scrollbar

PostPosted: Thu Sep 25, 2014 3:16 pm
by CFDaddy
Not sure if this will help but in a basic web page you can do it like the following:

Code: Select all
var textarea = document.getElementById('textarea_id');
textarea.scrollTop = textarea.scrollHeight;


You can also do it with jQuery like so:

Code: Select all
$(document).ready(function(){
    $('#textarea_id').scrollTop($('#textarea_id')[0].scrollHeight);
});


You can use the Web Client Utils plugins (https://www.servoyforge.net/projects/webclientutils) to get the actual ID of your rendered textarea and replace the 'textarea_id' above with what the plugin returns. This is all theroy at this point because I have not tried it yet but if I get some time today I'll test it out myself and let you know what I find. Hope that helps!

Keith

Re: Html Area Scrollbar

PostPosted: Thu Sep 25, 2014 5:29 pm
by CFDaddy
I built a sample solution and that process worked like a charm. I've attached it for you to review. Enjoy!