Search code examples
javascriptlightswitch-2013

Refresh after save Lightswitch HTML


I found this link and it contains an answer for that I am trying to do, I just cannot work out the code and am looking for some advice...

https://stackoverflow.com/a/26131894/5534230

I am trying to do the last section of this solution. I need the Browse Screen to refresh each time an item is edited. From my Browse Screen, I select an item. That navigates to an Edit screen. When I save the edit, I need it to apply the changes, revert to the Browse Screen, but also Refresh the Browse Screen after navigating there.

I am not sure what the 'Project' and 'Projects' items should be specifically, in the last part of that solution. Also, I am assuming this code needs to be added to the AddEditScreen by selecting it and choosing 'Write Code', correct?

Thank you so much!


Solution

  • Using this code on a custom Item Tap action method for the entity list on the Browse Screen has solved my problem...

    myapp.BrowseOrderLines.OrderLines_ItemTap_execute = function (screen) {
    // Write code here.
    myapp.showAddEditOrderLine(screen.OrderLines.selectedItem, {
        //beforeShown: function (addEditOrderLines) {
        //addEditOrderLines.OrderLines = screen.OrderLines.selectedItem;
        //},
        afterClosed: function (addEditOrderLine, navigationAction) {
            if (navigationAction === msls.NavigateBackAction.commit) {
                screen.OrderLines.refresh();
            }
        }
    });
    

    };