CRUD: Attach js to modal open/close


#1

Using the CRUD-component, I would like to attach some javascript code to run whenever it opens or closes a modal for editing.

I have this:
$crud->formUpdate = $crud->pageUpdate->add($crud->formUpdate ?: $crud->formDefault);
$crud->formUpdate->js(true, new jsExpression(<<<JS

JS

The above will run whenever I click the Edit-button in the CRUD. But now I would like to attach some code to run the moment the Modal closes again. How can this be done?

Specifically, I am trying to integrate the tinyMCE editor to textareas inside these Modals. I have that sort of working. The first time I press the Edit-button, tthe textarea is replaced with a tinyMCE editor.
But if I again press Edit, it is just a normal texteditor. I found that it is because tinyMCE is not destroyed when the Modal is closed.

-mads (gartner)