passing column info from xsl to javascript

D

Doogie

I have xsl code that looks like this:

<table id="TblTrips" border="0" cellpadding="1" cellspacing="1">
<tr bgcolor="#AAAAAA">
<td width="0.7in" align="center"> <b><U>Status</U></b></td>
<td width="0.7in" align="center"><b><U>Accepted Trips</U></b></
td>
</tr>
<xsl:for-each select="trip_detail_info[@trip_status=
$statusFilter]">
<tr onclick="GetDetail(this.rowIndex, event)">
<td><xsl:value-of select="@trip_status"/></td>
<td><input type="checkbox"></input></td>
</tr>
</xsl:for-each>

The problem I'm running into is with the GetDetail javascript method
that I'm trying to use when the user clicks on a column in the grid
this xsl is tied to. Here is my javascript method:

function GetDetail(rowNum, evt)
{
var columnInfo = evt.srcElement || evt.target;
alert(columnInfo.cellIndex)
if (columnInfo.cellIndex >= 1)
{
var currentRow = TblTrips.rows(rowNum)
var trip = currentRow.cells[15].innerText
popupWindow = window.open('TripDetailInfo.aspx?trip_detail=' +
trip + '&cur_user=' + curuser);
}
}

The problem is that for the checkbox row, columnInfo.cellIndex returns
"undefined" but for the non-checkbox row the columnInfo.cellIndex
value returns 0 (as it should). Does anyone know why the checkbox
column reacts differently and what I can do to fix it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,099
Latest member
AmbrosePri
Top