+ Start a Discussion
dkorba2k5dkorba2k5 

Freezing row columns in a datatable

OK .. here's an interesting one.  I have a datatable that has a bunch of columns where we want to have scrollbars.  However, we need the first column to stay static, i.e. as I scroll horizontally it will always be there.  But if I scroll vertically, it needs to scroll with the rest of the rows.  Any ideas how to do this?

stephanstephan

Here's an example:

 

http://fixed-header-using-jquery.blogspot.com/

 

...stephan

Jeremy.NottinghJeremy.Nottingh

I think this could be done natively, with a little HTML:

 

	<table style="max-height: 500px; overflow: scroll">
		<tr><td>
			<apex:datatable value="{!recordslist}" var="rec">
				<apex:column value="{!rec.Name}"/>
			</apex:datatable>
		</td><td style="max-width: 600px; overflow: scroll">
			<apex:datatable value="{!recordslist}" var="rec">
				<apex:column value="{!rec.field1}"/>
				<apex:column value="{!rec.field2}"/>
			</apex:datatable>
		</td></tr>
	</table>

 

Jeremy