locked
LS HTML - Deeper relationships are not loaded RRS feed

  • Question

  • Hi,

    I have the following custom control context in an add/edit dialog.

    Screen.Table1.Table2.Table3.field

    When I open the dialog, the field is undefined (actually I can see that table1 and table2 are defined but not table3).
    Then I close the screen (cancel) and reopen and now I can see my field.

    How can I tell LS to load my field without at first?

    Tks.

    Tuesday, October 22, 2013 4:59 PM

All replies

  • Hi,

    Could you please provide me with screenshot of it? And what’s the relationship between Table1 , Table2 and Table3?

    Please provide us more details to troubleshoot.

    In addition, there is a sample about Lightswitch HTML application. Please check the link below if it helps.

    An End-To-End Visual Studio LightSwitch HTML5 Application

    http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/176/An-End-To-End-Visual-Studio-LightSwitch-HTML5-Application.aspx

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 23, 2013 5:48 AM
  • Hi,

    Tks for the answer.
    The Relationship are 1 to many.

    Here is a printscreen of the first time I open the edit dialog:

    You can see undefined.

    Then I cancel and reopen and it's ok:

    Tks.

    François


    • Edited by francois.m Thursday, October 31, 2013 7:17 AM
    Wednesday, October 23, 2013 7:24 AM
  • Could you please post a screenshot of the screen designer for this screen so we have a better idea of how it's setup?

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Wednesday, October 23, 2013 5:45 PM
    Moderator
  • Hi,

    Sorry for the late reply, I was on holidays ;-) Here is a screenshot of the screen designer:

    Tuesday, October 29, 2013 8:58 AM
  • Thanks, I have a better idea of how your screen is setup now.  Can you also post the "Render" code for your custom control as that is likely where the problem resides.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Tuesday, October 29, 2013 2:49 PM
    Moderator
  • Sure, here it is

    myapp.AddEditMandats_Transaction.Mandats_Transaction_Bien1_Proprietaire1_AgentCo_id_render = function (element, contentItem) {
        var id = contentItem.value;
        var identifiant = id;
        if (id < 100)
            identifiant = '0' + id;
        if (id < 10)
            identifiant = '00' + id;
        $(element).append("<div>" + identifiant + "</div>");
    };

    Tuesday, October 29, 2013 3:17 PM
  • Hmm, this is working fine for me.  I have Entities setup like this:

    Contact has zero to many Addresses which have zero to many AddressTypes

    I have a browse screen for Contact, where I can view the Addresses, if I tap on one I have it open the Address View Screen which shows the AddressTypes and if I tap on on it opens the Add/Edit screen where I have setup a Custom control with your exact code, where the Control is bound to

    Screen.AddressType.Address.Contact.Id

    ...and I get the value right the first time.

    How are you navigating to this Edit screen?  Perhaps that makes a difference.

     

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Wednesday, October 30, 2013 2:29 PM
    Moderator
  • In a Bien view screen, I display a collection of Mandats_Transaction with a 'New' button. That button calls the AddEdit screen we are talking about with a new Mandats_Transaction.
    Wednesday, October 30, 2013 3:31 PM
  • The only way that I can get "undefined" to show up is if I create a setup where I create the Parent, Child, and GrandChild record all from nested dialogs, in this case the GrandChild screen with the custom control does show undefined, because the Entities have yet to establish their FK relations with each other (this is done on the server during the save).

    Can you try creating a new simple project with a Parent, Child, GrandChild setup and see if you can repro this issue with that project?

    Otherwise I think I would need to get your project to figure out what's going on.  If you would be willing to share the project, you can email me at 

    david (dot) kidder (at) microsoft (dot) com

    (I completely understand if you don't want to do share the project)


    David Kidder | Senior SDET | Microsoft | LightSwitch

    Wednesday, October 30, 2013 3:51 PM
    Moderator