Javascript Q: Dynamically Add Table Row and Locking Columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wattem
    New Member
    • May 2006
    • 1

    Javascript Q: Dynamically Add Table Row and Locking Columns

    Hi,

    This is my first post on this forum. Hello everyone!

    I am developing a .Net web app in C# and I am using javascript pretty extensively (to provide a richer experience).

    My server code data binds and creates a <table id="tblA"....> with rows of data. tblA is contained inside of a <div id="divA"....> whose Style.Overflow is set to scroll. I am freezing the first column of the table so that users can scroll right/left and still see this info.

    When the page is built by the server, the first column of each row will sucessfully freeze.

    When rows are dynamically added (on the client), the first columns do not freeze.

    The code (on the client) to add the rows is the same as that on the server. Below is the style for the first column for every row:

    style="LEFT:exp ression(documen t.getElementByI d('divA').scrol lLeft); POSITION:relati ve"

    My guess is that "divA" doesn't know that it needs to notify the LEFT attribute of the newly added rows when they are added dynamically.

    I greatly appreciated any help. I have been working on this all day and are hundreds of hairs shy of what I started with this morning.

    Thanks,
    Mark
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    This is an example solution. There are others too. The advantage is that they are cross-browser and don't depend on an IE-only CSS trick.

    Comment

    Working...