posted 16 years ago
Hey folks.
First time poster, be gentle with me.
I am currently having an issue with an internal webiste that has been causing me considerable grief.
I have tables with fixed header rows that are working well, with one very irritating exception.
We use an method on our text boxes to perform validation.
If the field has an error, we change the color of the text box to represent this. If the field is fine, we set it to the original color it was before we flagged it as an error. Pretty normal, right?
Well, this is when things get interesting. If the user scrolls down any amount in the table, and then clicks in and then out of the field, triggering the onblur, the fixed header jumps right out of the table. It's as if the top value is being set to where it WOULD have been in the table had the position not been set to relative. Further scrolling will not move the header from it's position on the page, until the onblur triggers again, with the header moving to a different position.
The problem is not with the onblur event or the text boxes. I have placed a button outside of the table and container div, and used it to cause the same problem by changing the class of a tr or td.
Some more background info before I post code.
1 It only occurs in IE7. (The only browser I need to support.)2 I know a way to fix the problem using an expression involving scrollTop on the headerRow, but I'd like to avoid it for performance reasons.3 The table MUST be variable width.4 I absolutely need to set a class, and not set individual styles. I have 100+ pages that use the validation classes in the js validation routines.5 The outer table is only there to force the container div to be the width of the scrolling table.
Here's the code. Sorry for the size. Make sure to change onblurMeth to onblur before trying this sample.