【问题标题】:How do I add a tablesorter action to a function如何将 tablesorter 操作添加到函数
【发布时间】:2024-05-23 01:25:01
【问题描述】:

当创建一个有 2 个动作的函数时,一个是返回确认,另一个是来自 tablesorter 的 applywidgets。

.trigger('applyWidgets');之前的函数中是否需要引用/加载tablesorter

【问题讨论】:

    标签: jquery function widget tablesorter zebra-striping


    【解决方案1】:

    在我添加到您的other question 的评论中,我分享了当您使用return confirm() 时,return 以下的任何代码都将被忽略。使用confirm,前面没有return

    触发的“applyWidgets”不需要任何对tablesorter 的引用。如果尚未应用 tablesorter,则表不会发生任何事情,也不会发生错误。

    function yeah() {
        confirm('Are you sue you want to delete?');
        $("#receipts").trigger('applyWidgets');
        return false;
    }
    

    【讨论】: