How to zoomToExtent with useSpatialIndex = false?

  javascript, openlayers

I have some problems with extents. I use Openlayers and a Mapserver WFS layer, with geojson as output format.
I need to get my features ordered in my geojson, so I set useSpatialIndex=false in the source vector.

But the problem is that I want to fit zoom with the size of the map, for different screen sizes.
So, is there a way to adjust zoom to layer extent without the function getExtent ?

Source: Ask Javascript Questions