Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Data Tables API获取特定单元格的数据表中的mData值?_Javascript_Jquery_Datatables - Fatal编程技术网

Javascript 如何使用Data Tables API获取特定单元格的数据表中的mData值?

Javascript 如何使用Data Tables API获取特定单元格的数据表中的mData值?,javascript,jquery,datatables,Javascript,Jquery,Datatables,我正在用预设的JSON数据初始化数据表。我使用mData将单元格值与列相匹配。当我单击任何单元格时,我想在数据表中获取特定单元格的mData。是否有一种使用Data Tables API获取mData值的方法 如果数据表中已有值,则无需使用mData 你应该试试这样的方法 $(".datatable tbody td").click(function () { var position = otable.fnGetPosition(this); var data = oTable

我正在用预设的JSON数据初始化数据表。我使用mData将单元格值与列相匹配。当我单击任何单元格时,我想在数据表中获取特定单元格的mData。是否有一种使用Data Tables API获取mData值的方法

如果数据表中已有值,则无需使用
mData

你应该试试这样的方法

$(".datatable tbody td").click(function () {
    var position = otable.fnGetPosition(this);
    var data = oTable.fnGetData(position[0]);
    //get the data of the cell
});

我将sClass值设置为与mData值匹配,然后使用标准JQuery:)获取该值。

我需要知道确切的列,而不是其中的数据。fnGetPosition没有帮助,因为列位置已重新排列,不再与原始数据相对应。您应该指定:)以及它现在是如何排列的?