Page include in popup: Data will not persist when popup closes, right?

  • 1
  • Question
  • Updated 1 year ago
  • Answered
When a page include is in a popup, am I correct that the page include's models and their data will not persist when the popup is closed?  So, for example, I would not need to use the popup's "after close actions" to empty the page include's models (via the XML) because that will happen automatically when the popup closes, right?  That's what appears to be happening, just making sure.

Thanks!
Photo of and thorough

and thorough

  • 736 Points 500 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Janick

Janick

  • 916 Points 500 badge 2x thumb
I'm not sure if I fully understand but if I do: yes you are correct.

If changes aren't saved after entering them they don't persist on the model after closing the popup.
The "after close actions" are being used to save changes and then requery the model (so the changes persist after close).

Let me know if this was what you were looking for, otherwise i'll look into it again! :)

Thanks,

Janick
Photo of and thorough

and thorough

  • 736 Points 500 badge 2x thumb
Thanks, Janick.  I think we are sort of talking about the same thing, but maybe not exactly because I'm asking about a case where changes are saved from within the page include's page in a popup.  Here is how I am using this:  I have a button that opens a popup.  The popup contains a page include component which loads a page to create a new Contact record, let's call that page NewContactPage.  NewContactPage has a model, let's call it NewContactModel that is set to create a new row each time the page loads: 
<model id="NewContactModel" limit="1" query="false" createrowifnonefound="true" datasource="salesforce" type="" sobject="Contact">
I save the new contact from within NewContactPage in the page include.  So, I think what is happening is that each time the popup closes, NewContactPage and its models are gone as far as the parent page is concerned.  And each time the popup opens, it reloads NewContactPage.  Is this right?  This is what appears to be happening, and is what I would expect, just want to make sure.

If that's how it works, great, and has a few implications:
  • I can't directly reference the popup-contained page include's data from models/actions on the parent page because the popup-contained page include's data doesn't persist outside of the popup.
  • can send data from the popup-contained page include to the parent page.  In my case, I have a multi-action button in the page include that saves the new contact and then updates a row on a model in the parent page with the new contact's id.  That seems to work well: if the parent-page model exists, it updates the row with the new id.  If not, it skips that action (this way, I can use the same page include in a few different parent pages, referencing each of those models from within the page include).
  • As I have read on this forum, it is generally not advised to use the same page include multiple times from a parent page.  But, it seems like this is not a problem to do from different popups on the same parent page (if the above is correct that the page-include-page's data is wiped out when the popup is closed).
I am proceeding with these assumptions and it seems to be working, so hopefully that's right.  Just making sure I'm not misunderstanding something that would come back to bite me in a delicate place later.  Thanks again for your help!
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
and thorough,

I think you are correct.  You can verify this by opening your page include and viewing the models in the console using 'skuid.model.map()'.  Then close the page include and view the models again using 'skuid.model.map()'.

One other thing to be aware of is that you need to make sure that your page include's model names do not conflict with model names from your parent page.  If the model has the same name, your page include model will overwrite your parent page model.

Thanks,

Bill