Design Question: EditableList-> EditableChild DataPortal_Fetch

Design Question: EditableList-> EditableChild DataPortal_Fetch

Old forum URL: forums.lhotka.net/forums/t/2488.aspx


isharko posted on Wednesday, March 07, 2007

Hi All,

In my Editable List I need to fetch data several times.

First time I fetch list of child objects based on some criteria and then when my EditableList is instantiated I need to fetch one more child based on some rules and add it to the previously loaded list.

When I do that by overloading DataPortal_Fetch it returns me EditListObject with only one child in it. All the previously loaded child objects are destroyed.

I need to know what is the appropriate way of doing this.

Thank you,

Igor.

 

 

 

JoeFallon1 replied on Thursday, March 08, 2007

It depends on what you know and when you know it.

If you know everything up front then you do all the work in the normal DP method call.

1. Load the full list.

2. Add the extra child object to the list.

3. Then return the fully loaded list.

It sounds like you are making 2 calls to the DP. The first call returns the fully loaded list. But the 22nd call destroys the list and returns only the extar child. This is the expected behavior.

If you need the full list but can only add the child later then your list needs a method to add a child.

My ECC lists all have methods like Add. I also include a function AddChild which takes the PK value, creates the child instance, adds it to the list and then returns me a reference to the newly created child. Then I can set the rest of the properties.

Joe

 

isharko replied on Thursday, March 08, 2007

As you adviced I've added the method to my EditableList to add a child to existing list.

Thank you,

Igor.

Copyright (c) Marimer LLC