Cmd+J, “order by type” (for example), “use as default” (freely translated from Swedish, it’s the button in the bottom though)

This works on the latest version of osx.