Could you maybe share what you already have?
I'm also trying to make a bulk action, that would download a CSV file of orders. Im coming so far to make the CSV but i can't get it to acually serve me a CSV file with a normal SubmitBulkAction feature.
I am also tryint using the ButtonBulkAction, but got the same JS error as you, sadly
this is the part for me that gives a "print_r" result of the orders and detail i need in my csv.
$params['definition']->getBulkActions()->add( (new SubmitBulkAction('mymodule_export_csv')) ->setName($this->l('Export Order CSV')) ->setOptions([ // in most cases submit action should be implemented by module 'submit_route' => 'mymodule_export_csv', ]) );
this is the ButtonBulkAction version i tries to do same with but gives the JS error
$params['definition']->getBulkActions()->add((new ButtonBulkAction('mymodule_export_csv')) ->setName($this->l('Export Order CSV')) ->setOptions([ 'class' => 'open_tabs', 'attributes' => [ 'data-route' => 'mymodule_export_csv', 'data-route-param-name' => 'orderId', 'data-tabs-blocked-message' => $this->l('It looks like you have exceeded the number of tabs allowed. Check your browser settings to open multiple tabs.') ], ]) );