gpt4 book ai didi

javascript - 在 datatables.net 上调用 fnGetPosition 会抛出 "Cannot call method ' toUpperCase' of undefined"错误

转载 作者:可可西里 更新时间:2023-11-01 02:53:12 25 4
gpt4 key购买 nike

我正在尝试使用以下代码获取数据表中一行的位置

var table = $('#UserInformationTable').dataTable();
var row_id = table.fnGetPosition($('#row_' + id));
table.fnDeleteRow(row_id);

$('#row_' + id) 返回一个 tr。

fnGetPosition 不起作用。我收到此错误:

TypeError: Cannot call method 'toUpperCase' of undefined

我做错了什么?

最佳答案

table.fnGetPosition(); 需要一个 DOM 节点,而您正在传递一个 jQuery 对象。将其更改为:

table.fnGetPosition($('#row_' + id));

table.fnGetPosition($('#row_' + id)[0]);

关于javascript - 在 datatables.net 上调用 fnGetPosition 会抛出 "Cannot call method ' toUpperCase' of undefined"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17583257/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com