Handle reordering of row hidden and filtered flags during sort.

Only when the "keep query" flag is set.

Change-Id: Ia799f62ec53a08cfd92e93c546965002c030b324