Search code examples
lightswitch-2013

Is there an event in Lightswitch html tables to intercept selected row change


I want to put a Delete button on my Screen whose state depends on if a row is selected in the Screen and some other conditions... basically I want to let the user be able to delete the current selected item, the problem here is that I can't find an appropriate event in the table to add custom logic when a new row becomes active.


Solution

  • In the delete button's _canExecute() method just put the following code:

    myapp.MyScreen.DeleteButton_canExecute = function (screen) {
        return screen.Orders.selectedItem != null;
    };
    

    You can also control whether the button is visible when disabled by checking or unchecking the "Hidden if disabled" checkbox in the properties for the selected button.