I was able to reproduce the issue with the above code by placing the showrowdetails and hiderowdetails calls in timeout functions, like so:
setTimeout( function(){ $('#jqxgrid').jqxGrid('showrowdetails', 0); }, 1000);setTimeout( function(){ $('#jqxgrid').jqxGrid('hiderowdetails', 0); }, 2000);