Move row grid functions to js file