Hi

Can I add a scroll bar (horizontal) to a table or table cell for a custom theme

Thanks
shoa

Comments

stevenc’s picture

It's not a normal technique to add a scroll bar to a table cell, and I don't believe that there is a direct way to do so.

The only work-around I can think of is to add a div within the table cell, then add "overflow: scroll" to that div.

May I ask what you trying to accomplish? There may be another way to meet your goal without using a scroll...

---------------------------------
Steven Wright

Slalom

johnhelen’s picture

A column in my table stores URLs. Sometime, the URL is too long - that column will be wide and so the table. The table crosses over the border to the right of the screen and it looks so ugly.

Therefore, I want to have a scroll bar and put my table in there so I can scroll it if the table is too large

I want to create a function that will add tag < br/> for long url. However web browsers display tag < br/> as I display these url as clickable links. E.g:

$rows[] = array(
..
l("http://myone.com/<br/>web",  "http://myone.com/web")
..

The url displayed in Web browsers has the tag < br/> and was not broken down into two lines as I want

Thanks

stevenc’s picture

I would use the PHP function wordwrap that breaks the URL display string up into smaller pieces, with a space between them. You don't need the "br" tag because the browser will automatically wrap the long text at a space, in an effort to keep the table within its assigned boundaries.

Simplified example:

$linkOrg = "http://myone.com/web/reallylongurl/goeshere/";
$linkDisplay = wordwrap($linkOrg, 10, " ", true);
l($linkDisplay,  $linkOrg)

Reference:
http://www.php.net/manual/en/function.wordwrap.php

---------------------------------
Steven Wright

Slalom

johnhelen’s picture

I follow your suggestion, using function str_replace ("/", " /", $long_url).
So new line is created when there is "/" character

Thanks

htwj’s picture

Try using a to indicate where the browser can wrap the line - see http://www.quirksmode.org/oddsandends/wbr.html for more info.

So...

str_replace ("/", "<wbr>/", $long_url)