The following comment has been added to this issue:
Author: Matt Raible
Created: Mon, 8 Nov 2004 10:42 AM
Body:
Here's something you can use while you wait for this feature to be added.
function highlightTableRows(tableId) {
var previousClass = null;
var table = document.getElementById(tableId);
var tbody = table.getElementsByTagName("tbody")[0];
var rows = tbody.getElementsByTagName("tr");
// add event handlers so rows light up and are clickable
for (i=0; i < rows.length; i++) {
rows[i].onmouseover = function() {
previousClass=this.className;this.className+=' over' };
rows[i].onmouseout = function() { this.className=previousClass };
rows[i].onclick = function() {
var cell = this.getElementsByTagName("td")[0];
if (cell.getElementsByTagName("a").length > 0) {
var link = cell.getElementsByTagName("a")[0];
if (link.onclick) {
call = link.getAttributeValue("onclick");
// this will not work for links with onclick handlers that
return false
eval(call);
} else {
location.href = link.getAttribute("href");
}
this.style.cursor="wait";
}
}
}
}
I put this in a global .js file and then call it after my </display:table>
using:
<script type="text/javascript">highlightTableRows("userList");</script>
Where my table has an id:
<display:table id="userList">
HTH,
Matt
---------------------------------------------------------------------
View this comment:
http://jira.codehaus.org/browse/DISPL-92?page=comments#action_26205
---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/DISPL-92
Here is an overview of the issue:
---------------------------------------------------------------------
Key: DISPL-92
Summary: Add support for javascript events on <tr> elements
Type: New Feature
Status: Unassigned
Priority: Major
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: DisplayTag
Assignee:
Reporter: Maarten Coene
Created: Mon, 8 Nov 2004 8:22 AM
Updated: Mon, 8 Nov 2004 10:42 AM
Description:
Hi,
we need to execute some javascript function when we click on a table row, but
there is no way to specify this with the curren taglib API.
We need something similar like the standars struts html tags where you can
specify a javascript funtion for each event.
For instance, it would be great if something like this could be added:
<display:table onrowclick="myfunction(this);">
...
</display>
this could generate:
<table>
<tr onclick="myfunction(this);">
...
</tr>
<tr onclick="myfunction(this);">
...
</tr>
</table>
the other javascript events could be handled simulary
regards,
Maarten
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel