Editor - How to perform some custom DB operations after (Postedit not suitable)

Editor - How to perform some custom DB operations after (Postedit not suitable)

shogunnshogunn Posts: 2Questions: 1Answers: 0
edited March 2017 in Free community support

Hello,
I am using editor and everything is working properly. However, I would need to do some databases updates (on several tables including my working table) after editor has done it's own updates, but before datatables refresh the table.
If I use postedit, i can make the updates, but i need to reload the page manually before it updates.
If I use preedit, i cannot easily access all my data. (I use inline editing, so $values only contains edited field)
The goal is to perform several calculations and updates, involving several tables.
Any idea ?

Thanks a lot.

Edit : basically I just need a server script that will output the json after I made my DB changes so how to decorrelate the table.mytable.php script between editor stuff and datatables stuff

Answers

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin

    Hi,

    Currently there isn't a way to do this I'm afraid - you'd need to call ajax.reload() on the table when the submit completes (submitComplete).

    Another option would be to insert a suitable callback into the Editor.php file (immediately before the line // Full data set for the modified row which would let you modify the database as needed before Editor reads the data back.

    More generally I think that this is something that should be included in Editor - thanks for the suggestion!

    Allan

  • shogunnshogunn Posts: 2Questions: 1Answers: 0

    thanks Allan for the quick response!
    I will try that. As for the second solution, would you have a piece of code ? As I don't understand so well how to implement the callback in the php file.
    Great piece of software btw.

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin

    The easiest way would probably be to search for references to postEdit in the Editor.php file and copy that structure for a new event. I'm not sure what the best name for it would be... Any suggestions?

    Regards,
    Allan

  • allanallan Posts: 63,356Questions: 1Answers: 10,447 Site admin

    Just to confirm, this will be in Editor 1.6.2. The events are called writeCreate and writeEdit.

    Allan

This discussion has been closed.