Sorting items to top of grid when hiding some of them : I am working on a catalog for a website that uses a grid to show different purchaseable items.
Now I have a function that will hide certain items in the grid by clicking a button. But when clicked the items that are still visible stay in their original position in the grid. 
So if i have 6 items spread over 3 rows and 2 columns as such: 1 2 3
                                                               4 5 6
    and then perform the function to lets say hide numbers dividable by 2 the grid looks like this         1   3
                               5

Is there a way to make the grid look like this instead? 1 3 5


