Implementing the filtering functionality for the grid