refactor dialogs/grid.js and implement Database.Transaction