This Forum is ARCHIVE only
For LightSwitch questions,
please use the official forums at:

http://social.msdn.microsoft.com/forums/en-US/lightswitch/threads


Screen cancel event
Last Post 12 Aug 2013 03:53 PM by inken. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
PinkyUser is Offline
New Member
New Member
Send Private Message
Posts:9
Avatar

--
11 Aug 2013 04:57 PM
    Hello, 
    I open a screen by the code you see below:

    myapp.BrowseOrderSet.AddNewOrder_execute = function (screen) {
     var newItem = myapp.activeDataWorkspace.ApplicationData.OrderSet.addNew();
     newItem.Number = "0";
     var ret = myapp.commitChanges().then(function () { myapp.showAddEditOrder(newItem, {
         afterClosed: function (addEditScreen, navigationAction) {
           if (navigationAction === msls.NavigateBackAction.commit) {
                  _thisModel.myAP_RefreshEditItem(newItem, null);
             }
          }
      });
     }, function fail(e) {
         msls.showMessageBox(e);
         myapp.cancelChanges();
      });
     };


    If the user now "Cancel" the screen the created item stays on the database. How can I get to the Screen Cancel event to delete the "newItem"?
    PinkyUser is Offline
    New Member
    New Member
    Send Private Message
    Posts:9
    Avatar

    --
    12 Aug 2013 03:53 PM
    sorry.... not see the wood for the trees

    thats what I need...
    
    myapp.BrowseOrderSet.AddNewOrder_execute = function (screen) {
        var newItem = myapp.activeDataWorkspace.ApplicationData.OrderSet.addNew();
        newItem.Number = "0";
        var ret = myapp.commitChanges().then(function () {
            myapp.showAddEditOrder(newItem, {
                afterClosed: function (addEditScreen, navigationAction) {
                    if (navigationAction === msls.NavigateBackAction.commit) {
                       // do something
                    }
    
    
                    if (navigationAction === msls.NavigateBackAction.cancel) {
                      // do something
                    }
    
    
                }
            });
        }, function fail(e) {
            msls.showMessageBox(e)
            myapp.cancelChanges();
            throw e;
        });
    };
     
    You are not authorized to post a reply.


    Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation