XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 9th, 2004, 03:41 PM
vehemon vehemon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 3 vehemon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old March 16th, 2004, 02:04 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Rather than using the rowIndex can you use the value of a unique field in each record to identify the record you're looking for?

I think the reason what you're doing isn't working is because you're not actually sorting the data, you're just sorting the display. When your javascript accesses the data it's still in its original format.
__________________
-james

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > sort/table/onclick problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT