This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

calculating table height based on table content



hi,

i am creating a dhtml table which has a scrollable content section. i need
to set the height of the tables content in pixels (the column headers and
footer are static height) so that the scrolling function knows how much it
needs to scroll up and down these rows.

i currently calculate the height of this area by...
<xsl:variable name="content_height"><xsl:value-of
select="count(//row)*25"/></xsl:variable>
which is fine when all of the data fits nicely into the column. however, if
the data is wider than the set width, it wraps onto the next line, etc... so
i need a way to determine how many "lines" each row is taking up. the number
of columns and rows are variable. the width for the columns + row_data is
set inside the column elements.

for each row i need to check all of the row_data's for the length of their
content and divide it by the width set in its correlating column element
adjustinf with some approximate for pixels/letter, giving me the approximate
# of lines this row takes. then for each row i just count the greatest, to
determine how many lines this row takes up, then sum all of these together
and multiply by 25 as my set row height.

i don't know that i explained this well,
it seems like quite a mess to me,
but here is a generic example of my data...
thanks,
matt

<?xml version="1.0" encoding="UTF-8"?>
<tab>
	<columns>
		<column width="25">...</column>
		<column width="100">...</column>
		<column width="50">...</column>
		<column width="77">...</column>
	</columns>
	<rows>
		<row> 
			<row_data>...</row_data>
			<row_data>...</row_data>
			<row_data>...</row_data>
			<row_data>...</row_data>
		</row>
		<row>
			<row_data>...</row_data>
			<row_data>...</row_data>
			<row_data>...</row_data>
			<row_data>...</row_data>
		</row>
	</rows>
</tab>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]