
March 9th, 2004, 03:41 PM
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
sort/table/onclick problem
I'm trying to figure out how to make the onclick call use the right row after a sort.
Right now, the table sorts but doesn't keep up with how it was sorted.
For example, If I click row #2 on the table, that doesn't necessarily mean that it's row #2 on the xml recordset.
The top table will display whatever is the second record despite the sort.
Code:
<head>
<script type="text/javascript">
function testclick(field)
{
var row=field.rowIndex
xmldso_shows.recordset.absoluteposition=row
td_longdate.innerHTML=xmldso_shows.recordset("longdate")
td_time.innerHTML=xmldso_shows.recordset("time")
td_location.innerHTML=xmldso_shows.recordset("location")
td_link.innerHTML=xmldso_shows.recordset("link")
}
</script>
</head>
<body text="white" style="font-family:Arial,helvetica,sans-serif;font-size:12pt;background-color:black">
<xml id="xmldso_shows" src="shows.xml"></xml>
<table border="1" bgcolor="red" align="center">
<tr align="left"><th>Date: </th><td id="td_longdate"></td></tr>
<tr align="left"><th>Time: </th><td id="td_time"></td></tr>
<tr align="left"><th>Location: </th><td id="td_location"></td></tr>
<tr align="left"><th>Link: </th><td id="td_link"></td></tr>
</table>
<hr></hr>
<center>Click on any row for more information</center>
<table border="1" align="center"><br></br>
<thead>
<th>Date</th>
<th>Location</th>
<th>Time</th>
</thead>
<xsl:for-each select="events/event">
<xsl:sort select="date"/>
<tr onclick="testclick(this)">
<td><xsl:value-of select="date"/></td>
<td><xsl:value-of select="location"/></td>
<td><xsl:value-of select="time"/></td>
</tr>
</xsl:for-each>
</table>
</body>
Try to find away to sort using a data island but couldn't.
Thanks for your help
|