locked
How to modify a Child Collection's Add item model dialog RRS feed

  • Question

  • I have a couple combo boxes that are used to filter the data that is returned to a List and Details screen. On this screen, the Screen Data table has 2 child tables and the child records are displayed in 2 tabs under the detail fields.  When I click the Add button to add a new child item, I want to be able to filter the records based on the dropdowns and change the layout of the modal Add New dialog that appears. 

    Can anyone point me in the right direction to accomplish this?
    Thanks,

    Bob

    Tuesday, December 18, 2012 6:43 PM

All replies

  • Take a look at Sheel's blog post or Yann's post for complete instructions on how to build a custom reusable modal window.

    If you want to make a one-time custom modal, you can add a local property of the table you want to add records into to the screen and make it a modal window.  Override the code of the default add and edit new button to open the modal window (your local property), and initialize a new record in your child table and set defaults like this:

    Me.MyLocalProperty = Me.MyChildCollection.AddNew()

    Me.MyLocalProperty.SomeProperty = Me.MyParentCollection.SomeProperty

    From there you can initialize any of the other properties and set defaults however your want.  You can add queries to filter the ACBs in your new modal window.  Once a query is added, click on the ACB you want to filter, and set the query source "choices" to your filtered query.  Bind the query parameter to the Id of the corresponding property of the parent table.  Sorry, I don't have an example or screenshots handy, but hopefully this can get you started.  You can do a lot with custom modals, I use them all over the place in my application.


    • Edited by Hessc Wednesday, December 19, 2012 3:02 AM
    • Marked as answer by Angie Xu Wednesday, January 9, 2013 3:00 AM
    • Unmarked as answer by Yann DuranModerator Sunday, January 13, 2013 8:59 AM
    Wednesday, December 19, 2012 2:59 AM
  • Thanks Hessc - unfortunately I am not looking to add a new record - I need to add a reference to another record.  Popping up the modal dialog is fairly easy.  But what I need to do is pop up a modal dialog that is a list where I can pick a child record.  For example, my screen has a list of orders, and a tab that shows the parts associated with the order.  When I press the + button in the tab, I want modify that modal that already appears.  I can replace it w/my own modal but if I add the group under the tab layout it only allows my to return a single entity.  If I put it outside the tabs, it shows up all the time.

    I hope what I am trying to do makes sense.  If someone has an example, that would be appreciated.

    Bob

    Friday, January 11, 2013 1:26 PM
  • Have you tried using a ModalWindowPicker control? It's designed to do what you're wanting if I understand correctly.

    PS - if a moderator marks an answer that you don't feel actually answers your question, please feel free to unmark it so that people will know you're still looking for an answer.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Sunday, January 13, 2013 9:02 AM
    Moderator
  • Thanks Yann (and thanks for the moderator tip).  Where do I find ModalWindowPicker?  No matter where in my tree I add a new group, only have ModalWindow as an option.  (To be accurate, I have Address Editor, Address Viewer, Columns Layout, Group Box, Modal Window, Picture and Text, Rows Layout, Table Layout, Tabs Layout, and Text and Picture).

    Any help is appreciated.
    Bob

    Friday, January 18, 2013 2:44 AM
  • You're welcome Bob!

    You can change any AutoCompleteBox control to a ModalWindowPicker control.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, January 18, 2013 2:58 AM
    Moderator