Modal with custom view sortable javascript?

I have a page with a custom modal configured like so
            $action = Action::make('order_item_process_steps')
            ->label('Process steps')
            ->modalContent(fn(OrderItem $item): View => view(
                'tables.order-item-process-steps',
                [
                    'orderItemProcessSteps' => $item->orderItemProcessSteps,
                    'isReleased' => $releaseService->isReleased($item->order),
                    'rootStep' => $item->root_step_no,
                ],
            ))
            ->modalSubmitAction(false);

we used to have our pages as plain livewire, and we were using sortablejs , however the javascript in the view does not seem to work, I can't even seem to get a console log! Can anyone help?
Solution
This is because livewire loads after the dom, you should load in the JS function into the app.js for example and then run the function. I.e. see
https://livewire.laravel.com/docs/javascript
Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Was this page helpful?