Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draggable CRUD not working inside modal action #2126

Open
mkrecek234 opened this issue Nov 2, 2023 · 1 comment
Open

Draggable CRUD not working inside modal action #2126

mkrecek234 opened this issue Nov 2, 2023 · 1 comment

Comments

@mkrecek234
Copy link
Contributor

mkrecek234 commented Nov 2, 2023

I have a crud which itself has an addModalAction that opens a modal show a child model's crud. If I addDraggable to that child model's crud, it throws an error:

$crud = \Atk4\Erp\Crud::addTo($app);
$crud->setModel($model = new Model\TicketType($app->db));

$crud->addModalAction(['icon'=>'tags'], ['title' => 'Edit tags'], function ($v, $id) use ($crud, $model) {
    $entity = (clone $model)->load($id);
    $crud2 = \Atk4\Ui\Crud::addTo($v);
    $crud2->setModel($entity->ref('TicketTags'));

    $dragHandler = $crud2->addDragHandler();
        $dragHandler->onReorder(function ($order) use ($model){

            $model->atomic(function () use ($model, $order) {
                foreach ($model as $entity) { $entity->save(['sort' => array_search($entity->id, $order)]); }
            });

           return new \Atk4\Ui\Js\JsToast('New sort order saved.');
        });


});

The error is API JavaScript Error Can't find variable: Draggable upon opening of the modal.

@mvorisek mvorisek changed the title Draggable crud not working inside modal action Draggable CRUD not working inside modal action Nov 3, 2023
@mvorisek
Copy link
Member

mvorisek commented Nov 3, 2023

related with #1875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants