working sorting on grid