var rs = $('#dg').datagrid('getSelected');
if (rs){
var index = $('#dg').datagrid('getRowIndex',rs);
//alert(index);
}
$('#dg').datagrid({
onLoadSuccess:function(){
//if(window.index)$('#dg').datagrid('selectRow', index);
$('#dg').datagrid('selectRow', index);
}
});