Refresh subpanel values through a logic hook?

Hello

I have a relationship hook which updates data in 2 subpanels and a regular field. 

It works, well but to see the changes I need to manually reload the page. I know that logic hooks deal with back-end modifications, but is there a way to invoke some kind of a method which would force a reload of a given subpanel's values? Worst case, may be a reload of the whole page?

Thank you

Parents
  • Hi Robert Sinclair 

    Let me make sure if I got the point.

    You update the main record (Record View) and this update (save) triggers a relationship logic hook which updates a specific field in records of 2 subpanels?

    If my understanding is right so you can create a custom RecordView for the module and override the method "_saveModel" in order to, after saving the record, refresh the entire page accordingly.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • Hi Robert Sinclair 

    Let me make sure if I got the point.

    You update the main record (Record View) and this update (save) triggers a relationship logic hook which updates a specific field in records of 2 subpanels?

    If my understanding is right so you can create a custom RecordView for the module and override the method "_saveModel" in order to, after saving the record, refresh the entire page accordingly.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
  • Hi André

    Thank you for the reply, I'm in CE, so I'm not sure if I have a RecordView. I did a bit more research and it looks like I need to implement some custom JS that will "listen" to a refresh of a subpanel and when it happens it will automatically refresh more subpanels, I just can't find any working examples for CE anywhere

  • I think the solution to my problem is described here: How can i refresh a specific subpanel in the Detailview ,but I can't figure out just one thing.

    It says I should call the showSubPanel('[relation_name]',null,true); to refresh that 'relation_name' sub-panel, but 

    1) Where do I put this code

    2) What is the code of the logic that checks to see if another sub-panel was updated?

  • Finally found a solution...

    To summarize for those reading, you need to create a custom controller in

    custom/modules/PARENT_MODULE/controller.php

    When you change something in your sub-panel it will generate a new $_REQUEST (in real-time) so when you're satisfied that the right sub-panel is being manipulated you can fire the showSubpanel('FIELD_NAME',null,true); action.

    Here's a video that explains it:


    https://youtu.be/wqLAIp52CIA