These codes should be executed only when a dropdown is shown. In addition, `ListView` has a responsibility for managing dropdown's design. So, please move the logic to `ListView#render` method. At the method, you can use `html` variable to insert header and footer.