Set event handlers only when data is available.