Extending Views in SugarCRM 7 with JavaScript

Recently I needed to fix a SugarCRM 7 view that had been customised/extended in JavaScript and accidentally broken. It turned out that the “events” object had been overridden instead of extended, and the view had lost some functionality.