Oh! You are talking about the outline?
Sorting is static in the Outline, NOT dynamic. Sorting in the Outline changes where the tasks "live". Sorting in Todo view changes how you see them.
You are probably better off with a custom Todo view that is just what you want. It's more powerful to use Outline as a static structure and then Todo views for ordering, slicing, dicing, etc.
I have my Outline grouped by the life focus area that the tasks live in. Then I can zoom into one area and focus on that, and all of the Todo views will also focus on that area, temporarily.
In Todo view, make sure you aren't in manual sorting mode, and that Flag is the topmost sort field, if that is the way you want to do it. group by flags, rather than sort. Let me know if you need details.