This.rowIndex Question
Jul 23, 2005
Can someone please tell me why this simple piece of code, irritatingly,
fails to give the expected result?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Sample Code</title>
</head>
<body>
<table id="table1" border="1">
<tr>
<td onClick="alert(this.rowIndex);">Tell me which row</td>
</tr>
<tr>
<td onClick="alert(this.rowIndex);">Tell me which row</td>
</tr>
<tr>
<td onClick="alert(this.rowIndex);">Tell me which row</td>
</tr>
</table>
</body>
</html>
View 4 Replies
Sep 29, 2006
Most JS people have seen sorttable.js and similar implementations.
I'm trying to do a SubSelect of an existing table, restricting values
in a Column to spec. range.
Rows manipulated through sorttable are not copies of the row objects,
they are ref's to the tbl row. Therefore care must be taken not to
delete them if they are needed, etc.
I'm getting used to the API:
tbody.deleteRow(rowIndex)
tbody.insertBefore(oRowI, oRowJ);
tbody.replaceChild(oRowI, oRowJ);
tbody.appendChild(row)
At some point during sort, the rowIndex gets re-ordered, I'm just not
sure when.
One strange result in my testing (possibly programmer error) of
deleteRow()
for (var k=0; k<telem.tBodies[0].rows.length; k++)
telem.tBodies[0].deleteRow(k); Code:
View 2 Replies
View Related
Jul 23, 2005
When I call addField(), my table appears to be populated correctly
with a new row in the table with all the required fields. However,
when I call delete row on any new rows that have been created, I get
the following error:
Error: uncaught exception: [Exception... "Component returned failure
code: 0x80004002 (NS_NOINTERFACE)
[nsIDOMHTMLTableRowElement.rowIndex]" nsresult: "0x80004002
(NS_NOINTERFACE)" location: "JS frame ::
http://localhost:3000/form/edit_fields/1 :: removeField :: line 65"
data: no]
The error appears to happen when the last line of removeField() gets
called...specifically rowToDelete.rowIndex throws the exception.
I should mention that I am running this code on Firefox 1.0, however,
when I run it on IE6, it doesn't work either, but I don't know what
the error is (I just don't know how to get a trace of the JavaScript
errors). Code:
View 7 Replies
View Related
Jun 8, 2010
I'm dynamically creating an HTML table using JQuery. I'm not assigning id's to the tr or td tags in the table. The reason I'm not, is that it seems complicated, given that the table is initially loaded and then the user can add and delete rows. I'll also need to sort the table on demand.
I maintain the current row the user has clicked on as a global variable (curRow) using this...
$("#prodTable tbody tr").live('click', function() {
curRow = $(this)[0].rowIndex;
});
I want to do input validations on certain cells based on values in other cells in the row. for example, the value of cellA cannot be greater than the sum of the values of cellB-CellD. The question is, given a certain table rowindex, how can I access the cells in the row? Is this not a good approach?
View 4 Replies
View Related
Aug 5, 2011
How to find control inside row of selected rowindex. Here when i select first row, class must be toggled with tat row only.
[CODE]
$("td.Normal").hide();
$("td.Edit").show
[Code]....
View 2 Replies
View Related