locked
Open Screen without discarding or saving changes RRS feed

  • Question

  • As I understand I have to discard or save changes before I can change screens. Is there a workaround? If I entered all details, but at the end noticed that one of the required entities isn't in the database, how can I import this entity without loosing data from this screen?

    In other words can I open AddEdit Screen from AddEdit Screen without loosing or saving data?

    Tuesday, October 7, 2014 12:40 PM

Answers

  • Not sure I'm understanding you correctly.

    If you call an AddEditScreen from another they will result nested in the same transaction, so Yes, you can.

    The final Save action on the starting entity screen will save everything.

    For example, if in OrderDetailAddEditScreen you need to create a new/missing Product before inserting your row, you can add a button in your Command Bar and use button's Tap Action to show ProductAddEditScreen.

    In your Tap action code you can check if user saved the new Product and set it on your Order Row.

    myapp.showAddEditProduct(null, {
         beforeShown: function (editScreen) {
             var PRD = new myapp.Product;
             editScreen.Product = PRD;
         },
         afterClosed: function (editScreen, action) {
             if (action === msls.NavigateBackAction.commit) {
                screen.OrderRow.Product = editScreen.Product
             }
         }
    });
    
    Please double check, I've copied in some different code and changed manually...


    Marco

    • Marked as answer by vsamsinovs Tuesday, October 7, 2014 3:22 PM
    Tuesday, October 7, 2014 1:27 PM

All replies

  • Not sure I'm understanding you correctly.

    If you call an AddEditScreen from another they will result nested in the same transaction, so Yes, you can.

    The final Save action on the starting entity screen will save everything.

    For example, if in OrderDetailAddEditScreen you need to create a new/missing Product before inserting your row, you can add a button in your Command Bar and use button's Tap Action to show ProductAddEditScreen.

    In your Tap action code you can check if user saved the new Product and set it on your Order Row.

    myapp.showAddEditProduct(null, {
         beforeShown: function (editScreen) {
             var PRD = new myapp.Product;
             editScreen.Product = PRD;
         },
         afterClosed: function (editScreen, action) {
             if (action === msls.NavigateBackAction.commit) {
                screen.OrderRow.Product = editScreen.Product
             }
         }
    });
    
    Please double check, I've copied in some different code and changed manually...


    Marco

    • Marked as answer by vsamsinovs Tuesday, October 7, 2014 3:22 PM
    Tuesday, October 7, 2014 1:27 PM
  • Thank you very much.

    Exactly what I wanted.

    Must of changed in the recent update

    Tuesday, October 7, 2014 3:22 PM