Freezing Datagrid Column Headers

G

Guest

Hi,
We have a datagrid with column headers. If the datagrid has more than say
25 rows the user needs to scroll down to be able to see the rest of the grid.
When the user does this the column headers scrolls up off the screen and it
becomes hard for the user to determine what the columns are. Is there a way
to keep the columns headers in place (only for vertical scrolling) when the
user scrolls down.

Thanks,
John
 
S

slagomite

First, wrap your DataGrid in a <div>, and set the div's "overflow"
style to "scroll". This way, the user won't have to scroll the entire
page to view the contents of the grid (and this is also necessary for
the following part to work right).

Then give the DataGrid's header the following styles:

position: relative;
top: expression(this.offsetParent.scrollTop - 2);

You might have to play around with border width, padding, etc. to get
it to look right, but this should do you what you want. Hope it helps.

Luke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top