Hi,
Back in the community version, I used javascript to customize my fields in the add and edit pages. It was pretty straight forward, I would merge my custom js file to the $crud->js_files and it would be loaded when the page was shown. I could add some triggers to some fields, and even insert some great controls like datetime pickers.
Now in the enterprise version, this trick doesn't work as easily as before, since add/edit uses modal dialogs that are not yet completely built when the datalist is shown. Jquery on() method works for javascript that needs to be triggered on some event of a field. But what I'm looking specifically is a way to trigger some javascript when the add/modals are shown. I could then override the fields the way I want (like change an input to a datetime picker).
The only modern way to accomplish this (I think) would be using MutationObserver. Now my code becomes much heavier and complex. I like my code to be very explicit and this is not helping.
Johnny, what about an option to "inject" some javascript files that would be loaded on demand after the add/edit modals are completely shown? I'm not sure what it would look like "API wise", but maybe you could think of something clean? If you could run the JS files after showing the dialogs, we could avoid using MutationObserver. A good way to start your exploration is to check this website. It's actually loading JS from and ajax call, and running it on demand, as explained here.
Anyone else have a better idea?
Thanks
Carl