Testing if row is last one in grid

I want to be able to automatically add a new row to the grid. To do that I must find out if the current row where the user is entering data is the last row. How do I get that information.

id 1, id 1 column 1, id 1 column 2
id 2, id 2 column 1, id 2 column 2
id 3, id 3 column 1, id 3 column 2
id 4, id 4 column 1, id 4 column 2
id 5, id 5 column 1, id 5 column 2

I want to automatically add a new row if the user is adding data in row id 5, the last row in the grid. How do I find out if the row being edited is the last row? There an on onEnter event, but this doesn’t tell me the row index. If I did have the row index, this still doesn’t tell me if this is the last row.

I have this now which seems to work.

		[code]card_links_grid.attachEvent("onEnter", function(id,ind){
		    var row_index = this.getRowIndex(id);
			var rows_count = this.getRowsNum();
			if (row_index == rows_count - 1) {
		        this.addRow("u000000000001","");
			}
	    });[/code]

If there is a better way, tell me.

You can use “onEditCell” event. Please find tutorial here docs.dhtmlx.com/doku.php?id=dhtm … oneditcell
You can find row index by it’s id

var rowIndex=mygrid.getRowIndex(rowId);