是否有一种方法可以在ASP.NET MVC Telerik中计算未保存的列单元格,然后在用户未在10行之后保存时创建一个弹出窗口

发布于 2025-02-03 06:52:43 字数 1092 浏览 1 评论 0原文

目前,我正在尝试计算用户编辑的未保存列的数量,以便弹出窗口会提醒他们保存或定期生成弹出消息。

我的问题是,我似乎无法使它工作大声笑,我可以创建弹出窗口,并且在打开或刷新时加载它,但是当我超过10个代码所要求时,它不会打开。实际上,我没有能够获得任何控制台。

<script>


   
    
    function onClose() {
        //$("#showDialogBtn").fadeIn();
        
    }

    function onOpen() {
       // $("#showDialogBtn").fadeOut();
        
    }

    function showDialog() {
        /*
    The general idea here is that you count the total number of
    unsaved columns before you release the show dialog
    */
        $('#dialog').data("kendoDialog").open();
        
        var ucc; // create total unsaved column count
        var grid = $('#Grid').data("kendoGrid");
        var gridData = grid.dataSource.view();

        for (var i = 0; i < gridData.length; i++) {
            (ucc += gridData[i].eTmfCompletenessComment);
        }
        if (ucc >= 10) {
            $('#dialog').data("kendoDialog").open();
            // $("#showDialogBtn").fadeOut();
        }
        else {
            kendoConsole.log(ucc)
        }
    
        
    }


    
</script>

Currently I am trying to count the number of unsaved columns a user has edited so that a pop up window will remind them to save or periodically produce the pop up message again.

My problem is i cant seem to get it to work lol, I can create the pop up window and it loads on open or refresh but it doesnt open when i have over 10 like the code is asking. Infact I havent been able to get any console.logs to the console window to debug if its even working and frankly im looking for some help with solving

<script>


   
    
    function onClose() {
        //$("#showDialogBtn").fadeIn();
        
    }

    function onOpen() {
       // $("#showDialogBtn").fadeOut();
        
    }

    function showDialog() {
        /*
    The general idea here is that you count the total number of
    unsaved columns before you release the show dialog
    */
        $('#dialog').data("kendoDialog").open();
        
        var ucc; // create total unsaved column count
        var grid = $('#Grid').data("kendoGrid");
        var gridData = grid.dataSource.view();

        for (var i = 0; i < gridData.length; i++) {
            (ucc += gridData[i].eTmfCompletenessComment);
        }
        if (ucc >= 10) {
            $('#dialog').data("kendoDialog").open();
            // $("#showDialogBtn").fadeOut();
        }
        else {
            kendoConsole.log(ucc)
        }
    
        
    }


    
</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别忘他 2025-02-10 06:52:43

这就是您将如何注册未保存的更改,然后警报是否有任何更改

<script type="text/javascript">
    window.addEventListener("beforeunload", function (e) {
        var confirmationMessage = 'It looks like you have been editing something. '
            + 'If you leave before saving, your changes will be lost.';

        (e || window.event).returnValue = confirmationMessage; //Gecko + IE
        return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.
    });
</script>

This is how you would register unsaved changes and then alert if there are any

<script type="text/javascript">
    window.addEventListener("beforeunload", function (e) {
        var confirmationMessage = 'It looks like you have been editing something. '
            + 'If you leave before saving, your changes will be lost.';

        (e || window.event).returnValue = confirmationMessage; //Gecko + IE
        return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.
    });
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文