Lightswitch html client override default save button

旧城冷巷雨未停 提交于 2020-01-07 09:04:53

问题


I want to be able to override the default save button on the html client however i cant seem to find the control to do so. I want to write some validation behind it and allow the user to select an option but I just cant seem to find it.

I know the silverlight client you can override it but just cant seem to override it in the html client.

thanks


回答1:


It's achieved using beforeApplyChanges.

example: (Please excuse any typos/syntax errors, you get the rough idea!)

myapp.AddEditScreen.beforeApplyChanges = function (screen) {
    switch (screen.Property_SavingStatus) {
    case 'Not Saving':
        setTimeout(function () {
            // Override Save -> toggle SavingStatus -> Call Save again
            SaveMyChangesMyWay();
            screen.Property_SavingStatus = 'Commit';
            myapp.commitChanges(); // Or Discard or Apply.
        }, 500);
        return false; // Cancel save changes request
        break;
    case 'Apply':
        return true;
        break;
    default:
};


来源:https://stackoverflow.com/questions/31780203/lightswitch-html-client-override-default-save-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!