[code]ToolBar.attachEvent(“onClick”, function(id) {
if(id == “refresh”) {
var selectedId = TestGrid.getSelectedRowId();
TestGrid.clearAndLoad(“getGridData.php”, doAfterGridRefresh(selectedId) );
//setTimeout(doAfterGridRefresh, 1000, selectedId);
}
});
function doAfterGridRefresh(id) {
alert(id);
TestGrid.selectRowById(id);
}[/code]
If I use the code as shown, I see an alert with the correct id, but the expected grid row will not be selected. It seems to be calling the callback function before the grid is finished loading. If I use the setTimeout line, everything works as expected. Any ideas?