I need to get a value from the first row of the grid right a

The loadXML command is async, so the next command called after it can be
executed before XML really loaded and parsed in grid. To be sure that
XML already loaded you can use onLoadingEnd event or second parameter of
loadXML command.

grid.loadXML(someURL,function(){
    //called after XML loaded
    alert(getRowsNum());
});