You can call 'getRowIndex' method to get the special row index. This method accepts an id field value as its parameter value. Before calling it the 'idField' property must be set.
var dg = $('#dg').datagrid({
idField: ...
});
var index = dg.datagrid('getRowIndex', idvalue);