Wavelength flipping in laser emission driven by a switchable holographic grating