getRowIndex error: 'is not defined'

I’m trying to add a couple of lines of code so that after a record is deleted (in a datastore attached to a grid), the next row is selected in the grid (instead of remaining undefined).

		else if (id=='btn_RestaurantsDel'){
				var selectedItem = restaurant_grid.getSelectedRowId();
				var selectedRow = getRowIndex(selectedItem); //<--STOPS ON ERROR 
				dsRestaurants.remove(selectedItem);
				restaurant_grid.selectRow(selectedRow);
		}

Weirdly, this code produces the error “Uncaught ReferenceError: getRowIndex is not defined.”

How can this be? getRowIndex is a documented grid function. Or am I once again missing something obvious?

[SOLVED]

YES, I was missing something obvious. I forgot to attach getRowIndex to an OBJECT. D’oh!

VVVVVVVVVVVVV var selectedRow = restaurant_grid.getRowIndex(selectedItem);

Never mind. Nothing to see here.