CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2005
    Posts
    53

    Freezing Header of the table

    Hi,

    I'm using JSP to display the content from the database in the form of Table. Table Rows and Columns are not statis, it may vary..

    I want to Freeze header of the table. I'm using MAC OS and using Safari as my Web Browser.

    Can anyone guide me???

    -haifriends

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Freezing Header of the table

    What do you mean freeze the header of your table? Does the content dynamically change even after the page is loaded?

    Why don't you define the top <tr><td>...</td>...</tr> section and then after that code loop through the database?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Dec 2005
    Posts
    53

    Re: Freezing Header of the table

    I want to freeze the top header portion and just scroll the content part.

    The first row of the table will have the heading of each column. This first row to be locked.

    Please guide me to solve this problem. I'm using Safari Browser.

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Freezing Header of the table

    Well, a table itself cannot do this, but you can build a table with the header row and then another table inside a scrolling div. You will have a problem with lining up the columns if you don't supply a fixed width.

    Code:
    <table>
      <tr>
        <td>Column 1</td>
        <td>Column 2</td>
      </tr>
      <tr>
        <td colspan="2">
          <div style="overflow: scroll">
          <!-- add the other table here -->
          </div>
        </td>
      </tr>
    </table>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Dec 2005
    Posts
    53

    Re: Freezing Header of the table

    Number of columns is not fixed, so i cannot get the width of the column.

    Is there any possible way to freeze the header of the table?

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Freezing Header of the table

    Quote Originally Posted by haifriends
    Number of columns is not fixed, so i cannot get the width of the column.
    I said width, not number of columns.

    Quote Originally Posted by haifriends
    Is there any possible way to freeze the header of the table?
    I just provided you with the only way.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured