Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with scrolling div around table with growing content

    I want a table's height to grow and scroll as the rows are dynamically added.

    I am currently using the following but the scroll bar won't show without a fixed height:
    overflow: auto;


    But, when the fixed height is used that causes the problem with the div being huge and waiting for content.

    Ideally, the table would scroll after 10 rows are created.

    Is there a way for the div to collapse and just grow vertically as the table grows and after 10 rows begin scrolling?

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    wrap a div around the table like this:

    Code:
    <div style="overflow:auto; height:500px;"></div>
    set height and or width to whatever you need

    Dont for get to put the closing div tag after the </table> tag. Hope that helps.

  • Users who have thanked teedoff for this post:

    Decker (08-26-2010)

  • #3
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for such a quick reply.
    Unfortunately when I apply a 500px height, the div is fixed at 500px height and takes up that much space on the page.

    I need the div to be, for the lack of a better phrase, "flat" until the div is filled in dynamically with rows. Basically grow as needed.

  • #4
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Thats what I had the height set as in my page. Play around with it for your own personal preference.

  • #5
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    I have a script on my page that allows 100 rows with navigation links to page through each 100 records in my databse. Maybe something else to look at.

  • #6
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think you misunderstood what I meant with my post. What I am trying to say is that I don't need a height attribute of any value on my page unless there is a way to make it collapse to zero and grow as needed. If I use any fixed height value the div stays that large and then scrolls after that.

  • #7
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    MAybe I did misunderstand, sorry. The way I have my page is when I perform a dynamic search, and 20 rows are returned in a dynamic table then it doesnt need or contain a scroll bar. If the results are returned and there are more rows than the div will allow, then the scroll bar will be utilized. Maybe post your code and explain again what you want, or post a site that contains the exact thing you're looking for. Sorry again for the misunderstanding. Good luck.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •