webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
795 stars 272 forks source link

rowIndex in EditableGrid.prototype.mouseClicked #86

Closed fitchk closed 9 years ago

fitchk commented 9 years ago

I've just started playing with editablegrid, and have run into a problem. I'm attaching to a small table with one header row, eight data rows, and eight columns. I make all the cells editable using the ...load( metadata ...) approach. When I try to edit a field, and hit enter, it fails because the row is invalid. It always returns 0. The column number is correct.

Working my way thru the code, there is logic in EditableGrid.prototype.mouseClicked that uses target.cellIndex to extract the column index, but calls function getRowIndex(target.parentNode) to get the row index. The correct rowIndex is actually in target.RowIndex. What am I missing? Why is the row/column logic asymmetrical?

fitchk commented 9 years ago

OK. The issue seems to have been that I did not apply "id"s to the rows in the table. Once I added an explicit label to each , it seems to work. I did not notice the various "id=R1", etc., lines in the example