Can I trigger "postCreate" for a record not created by Editor?
Can I trigger "postCreate" for a record not created by Editor?
For some of my tables, records are created through my own PHP controller/model set-up. The Editor files are referenced throughout, but the "Create" button is not presented to the user.
I now realise that it would sometimes be useful to hook into the Editor's "postCreate" function from my PHP. Is that possible - perhaps by access to Editor::ACTION_CREATE, for instance?
This question has an accepted answers - jump to answer
Answers
I don't think so, but let @allan or @colin check it out for your, tangerine.
If they can't help you there could be this work around. Even without showing the "Create" button to the user you can always trigger record creation using Editor from the front end like in here:
https://datatables.net/forums/discussion/comment/204784#Comment_204784
The example is about "editing" but "creating" works the same way ...
Thank you! I'll check your code out later.
It depends a bit what you want to get out of
postCreate
. Like, do you use the parameters passed to it? This is where it gets called, so while there isn't a way to trigger it outside of Editor, you could call a named function - e.g.:Again, it really comes down to the parameters that you need and what you have access to in this other location where you need to perform the postCreate action.
Allan
Thanks, Allan. I need to think this through again. It's begun to look like a fresh can of worms. I may come back from a different direction, as related problems have turned up. Oh woe.
Thanks again.