从详细信息页面删除后如何导航回列表页面?

时间:2017-01-23 01:20:57

标签: visual-studio-lightswitch

以下是我的详细信息页面上的删除代码:

/// <reference path="~/GeneratedArtifacts/viewModel.js" />

myapp.ViewReceipt.DeleteReceipt_execute = function (screen) {

    msls.showMessageBox("Are you sure you want to delete this record?", {
        title: "Confirm Delete",
        buttons: msls.MessageBoxButtons.okCancel
    })
    .then(function (result) {
        if (result === msls.MessageBoxResult.ok) {
            screen.getReceipt().then(function (receipt) {
                receipt.deleteEntity();
                //Save changes
                myapp.applyChanges().then(null, function fail(e) {
                    // If error occurs, show the error.
                    msls.showMessageBox(e.message, { title: e.title }).then(function () {
                        // Discard Changes
                        screen.details.dataWorkspace.ApplicationData
                            .details.discardChanges();
                    });
                });
                //navigate back to list page
                this.window.location.href = '#/BrowseReceipts.lsml'; //this doesn't work for me
            });
        }
    });
};

1 个答案:

答案 0 :(得分:1)

您应该能够通过修改代码来使用myapp.navigateBack()方法来实现这一目标。

一旦applyChanges成功完成,应该通过实现其onComplete回调来执行此方法,如以下修订示例所示:

B = kron(speye(M),ones(K));
B(logical(B)) = A;
相关问题