SharePoint: Postback not working after Export to Excel in SharePoint

A common issue which happens after clicking on the Export button is that Postbacks don't work. A workaround to avert this issue is to use the following script in the webpart:


<script type="text/javascript">
        
        if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' && _spBodyOnLoadFunctionNames != null) {
            _spBodyOnLoadFunctionNames.push("supressSubmitWraper");
        }

        function supressSubmitWraper() {
            _spSuppressFormOnSubmitWrapper = true;
        }
       
    </script>