Search code examples
javascriptvisual-studio-lightswitchlightswitch-2013

Lightswitch 2013 - passing a parameter to a details picker on load


What I am trying to do is add an item to an order. and I want it to pass the OrderID from the previous screen to the new screen (which I have achieved and you can see below) however the user still has to press the + arrow on the details picker and select it. I want to remove this and just do it automatically... any tips:

Error


Solution

  • Alternatively, you could query the database in the screen created method for the order that is passed in when the screen is shown.

    myapp.AddEditEquipment.created = function (screen) {
        //Whatever other initializing you have to do
        myapp.activeDataWorkspace.ApplicationData.Equipment_SingleOrDefault(screen.OrderIDPass)
            .execute().then(function (result) {
                screen.OrderRequest = result;
            });
    }