NetTalk Central

Author Topic: Refresh Parent Browse when Child Browse updated  (Read 5380 times)

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Refresh Parent Browse when Child Browse updated
« on: December 23, 2012, 03:38:59 AM »
NT 6.48

I have a Form with a Parent Browse and a Child Browse.  I want to apply a different CSS to the Parent Browse (to color the row) to indicate that there is a Child Record for the Parent.  That way, I can easily tell what parent records have children and which do not.

When I open the Form, the Parent Browse is properly loaded and the CSS applied.  How do I cause the Parent to be refreshed when a child record is added?

Mike Springer

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Refresh Parent Browse when Child Browse updated
« Reply #1 on: December 23, 2012, 07:20:59 AM »
Hi Mike,

I think you'll find a similar question (and answer) here :

http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=4107.0

Cheers,
Rene
Rene Simons
NT14.14

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Parent Browse when Child Browse updated
« Reply #2 on: December 23, 2012, 04:28:04 PM »
Thanks Rene,
I saw that posting, and even tried it, but it is not doing anything to the parent browse.  My child browse is not using EIP, but even when I added EIP and used the same template settings as the example and Bruce's suggested three lines, the parent browse is not being refreshed.

Still looking...
Mike

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Parent Browse when Child Browse updated
« Reply #3 on: December 23, 2012, 10:46:41 PM »
note that one of those lines sets the "parent" of the (parent) browse that you are refreshing.
In the example it sets it to blank, but if the browse you are resetting is on a form (maybe a memory form?) then you need to set that form name as the "parent".

Cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Parent Browse when Child Browse updated
« Reply #4 on: December 24, 2012, 03:35:21 AM »
Hi Bruce,
Yes, this is a memory form ("EnterContributions").  It contains a parent browse (let's call it "ListContributions") and its child browse ("ListDonations").

I have a popup form (no EIP on the browse) to add to the Child (UpdateDonations).  In the Child browse (ListDonations) I have the following code in the Record Validate embed:

  p_web.setValue('_ParentProc_','EnterContributions')
  p_web.DeleteValue('_EIPClm_')
  ListContributions(p_web)

This causes the parent browse (ListContributions) to be displayed to the right of the original ListContributions (so now I have two ListContributions browses next to each other, but the additionally displayed one does have the refreshed display with the updated colored line, but the original ListContributions is not updated.

Mike

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Parent Browse when Child Browse updated
« Reply #5 on: December 24, 2012, 05:37:05 AM »
It's hard to debug without seeing an example Mike.

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Parent Browse when Child Browse updated
« Reply #6 on: December 26, 2012, 06:24:35 AM »
Bruce,
Attached is an example (MSexample3) that illustrates the problem.  It is a Clarion 6.3 and NT 6.48 app

I've included the .APP, .DCT, Contribute.TPS, ConTrans.TPS, and the Custom.CSS files.  The example app runs on port 88.

To outline the example, there is a memory Form with a parent browse and a child browse.  The parent browse lists the Contribute.TPS file, and the child browse lists the ConTrans.TPS file.  The Custom.CSS is used to turn the parent browse row green if there is a child record.  You'll see that works when the app opens.

The problem is when you add a child record to a parent record that has no child yet, the CSS green is not applied because the parent browse is not being refreshed.

I've added the following code to the child's validate record embed:

p_web.setValue('_ParentProc_','EnterContributions')     !the Memory Form
p_web.DeleteValue('_EIPClm_')                     !don't know what this does
ListContributions(p_web)                                !Parent Browse

These are currently commented out because with them, the parent browse is redisplayed to the right of the parent, over and over until the server crashes in a few seconds.

Surely, I'm doing something wrong, but I'm not seeing what I'd doing wrong.

Thanks,
Mike


[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Parent Browse when Child Browse updated
« Reply #7 on: December 27, 2012, 12:03:59 AM »
Hi Mike,

in your example the UpdateDonations form is called in Page mode, so there would be nothing for you to do anyway.
The browse automatically refreshes when returning from a page mode form, so if it's not changing color then, then there's something else wrong.

If the UpdateDonations was called in popup mode, then the 3 lines would be added to the PostUpdate / PostInsert embeds in the _form_ and not in the browse.

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Parent Browse when Child Browse updated
« Reply #8 on: December 27, 2012, 05:32:50 AM »
Bruce,
Thanks for that.  I see that the popup form approach, with the embedded 3 lines does refresh the parent browse.  What I also noticed is that a delete does not.  I've added the three lines in the PostDelete embed, but no joy in refreshing the parent browse.

Hmmm... this sounds a bit like the current thread on refreshing the total field - apparently works on insert/change but not on delete.  Similar issue?

Thanks for your help,
Mike

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Refresh Parent Browse when Child Browse updated
« Reply #9 on: December 27, 2012, 05:46:34 AM »
Bruce,
My last post is not clear.

IF I use a popup form for the child browse's insert/update, and use the "three lines", then as you observed, the parent browse does get refreshed and all is well.

IF I use the page mode for the form, in my simple example, the insert and update (without the three lines) does indeed refresh the parent browse like you said.  HOWEVER, if I delete the child record, the parent browse is not being refreshed.

So, in page mode on a form, the parent browse is being automatically refreshed if the child browse has a recorded added or changed, but not if the child browse records are deleted.

Sorry for the poor wording of my last post.
Mike