You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Tabulator跨表格移动行时movableRowsSent回调异常触发问题

问题原因与解决方法
  • 核心问题:你在配置movableRowsSent时,写的是test(),这会在表格初始化时立即执行test函数,而不是把函数作为回调绑定到行移动完成的事件上。
  • 解决方法:把movableRowsSent: test()改成movableRowsSent: test,传递函数的引用而非执行结果。

修改后的发送表格代码:

var table_user = new Tabulator("#user-table", {
    layout:"fitColumns",
    height:311,
    movableRows:true,
    movableRowsConnectedTables:"#amb-table",
    movableRowsReceiver: "add",
    movableRowsSender: "delete",
    movableRowsSent: test, // 去掉函数后的括号
    placeholder:"Utenti",
    data:tabledata(),
    columns:[
        { title: "Utenti disponibili", field: "username" },
    ],
    ajaxConfig:{
        headers: {
          'X-WP-Nonce': '<?php echo wp_create_nonce( 'wp_rest' ); ?>'
        },
    }
});

这样修改后,test函数只会在行移动完成并发送成功后才会被触发执行,弹出alert。

内容的提问来源于stack exchange,提问作者Sergio Gandrus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 19:04:56