locked
create a details screen and set as default doesn't work for button, bug or by design? RRS feed

  • Question

  • Hi

    I need a custom edit screen so I created a new details screen and set it as the default details screen.

    If I set a property to "show as a link" on my entity it will show my new screen by default. That works fine.  However, if I add an "Edit Selected" button to the command bar it shows a LS generated modal edit form.

    How can I get a button to load my edit screen with the selected row? 

    Is this a bug or am I missing something?

    Gus

    Monday, July 30, 2012 10:51 PM

Answers

  • I think edit selected just does that no matter what.  You can code it directly.  Double-click on the edit button and add your code as needed.

    partial void UserListEditSelected_Execute()
    {
        var u = this.Users.SelectedItem;
        if (u != null)
            this.Application.ShowUserDetail(u.Id);
    }

    • Marked as answer by GusBeare Tuesday, July 31, 2012 6:14 AM
    Monday, July 30, 2012 11:09 PM
  • It's by design.

    Setting a default details screen has nothing to do with collection buttons. It only affects the ShowDefaultScreen method on the client Application object and the Summary control used in screens.


    Justin Anderson, LightSwitch Development Team

    • Marked as answer by GusBeare Tuesday, July 31, 2012 6:14 AM
    Tuesday, July 31, 2012 2:07 AM
    Moderator

All replies

  • I think edit selected just does that no matter what.  You can code it directly.  Double-click on the edit button and add your code as needed.

    partial void UserListEditSelected_Execute()
    {
        var u = this.Users.SelectedItem;
        if (u != null)
            this.Application.ShowUserDetail(u.Id);
    }

    • Marked as answer by GusBeare Tuesday, July 31, 2012 6:14 AM
    Monday, July 30, 2012 11:09 PM
  • It's by design.

    Setting a default details screen has nothing to do with collection buttons. It only affects the ShowDefaultScreen method on the client Application object and the Summary control used in screens.


    Justin Anderson, LightSwitch Development Team

    • Marked as answer by GusBeare Tuesday, July 31, 2012 6:14 AM
    Tuesday, July 31, 2012 2:07 AM
    Moderator
  • many thanks guys!

    code worked perfectly.

    One nice thing about being in the UK is I can post a problem here before I go to bed and some time during the night some kind chaps

    in the US or elsewhere post a solution and when I wake up it's there waiting for me!

    it would be a real struggle without all this great help

    thanks again

    Gus

    Tuesday, July 31, 2012 6:15 AM