Grid sorting query

- Added default grid sorting query implementation.