The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

UI details with collections

Last post 01-08-2008, 4:48 PM by David.Parsons. 1 replies.
Sort Posts: Previous Next
  •  01-07-2008, 9:57 AM 7484

    UI details with collections

    I have a collection of objects that have child collection many to many linked. I want to create a child object with a dialog and then either add the child or abort the action. The code below is in the modal dialog that opens when you want to create the child and then add it to the parent collection many-to-many linked. It works fine and adds the child, but the problem is this. Below the first block of code is the code that binds the parent and child collections. The problem is one of the UI updating not reflecting the collections state properly from a user's point of view. Clicking on the parent list displays the children list nicely, but when you create a child, then associate it to the parent and click ok with the dialog, the child list will not update to reflect the added child. If i instead add() the contact to the UpToContactCollection is displays perfectly, but this method is decremented. If I use the AddNew() method of the UpToContanctCollection to create a new COntact, it reflect the contact being added to the list in the UI regardless of weather you cancel or about the action. So again the UI has garbage displayed the is not reflecting the status of the collection. How to I properly create a contact (child) entity that is not displayed in the UI untill the change is commited and saved.
      
    Code:
                m_contact.EndEdit();
                m_contact.Save();
                manu.AssociateContactCollection(m_contact);
               // This works but is decremented!!  if I leave it out the UI will never diplay the new child untill the manufactureres are reloaded
                manu.UpToContactCollection.Add(m_contact);
                m_bs.EndEdit();
                manu.Save();
                Close();
    Code:
     private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                
                if (bs.Count > 0)
                {
                    m_manu = (BusinessObjects.Manufacturer)bs.Current;
                    this.listBox2.DataSource = m_manu.UpToContactCollection;
                    this.listBox2.DisplayMember = "FirstName";
                }
    
            }

    Richard Young
  •  01-08-2008, 4:48 PM 7519 in reply to 7484

    Re: UI details with collections

    I believe the esEntityCollection.Add method has always had an XML Summary stating that it was for internal use only. It probably was not until we changed the XML comments to an ObsoleteAttribute that it stuck out like a big, red sore thumb. As far as I know, it is not slated for immediate deprecation. Perhaps Mike can shed some light on why its use is a bad idea.
    David Neal Parsons
    www.entityspaces.net
View as RSS news feed in XML