我已经成功地设置了datatables,并使用了select扩展。当有人使用“报告”并加载另一页时,我有以下代码可以将表格中的某些单元格内容传递给报告。这个很好用,但是,我需要能够传递每个的data-element而不是行数据...
这是我的当前代码:
这是我的当前代码:
var table = $('#table_search_project').DataTable();
//then re-run the code to get the selected rows
var id_list = $.map(table.rows('.selected').data(), function (item) {
return item[1]
});
因此,您可以看到,我曾经使用item[1]
进行返回,但我真的想要能够获取<tr>
对象,以便我可以检索data-something-id
属性(但我不想显示它-因此出现了问题)
.data()
自jQuery 1.2.3版本以来就存在了 - 您正在运行哪个版本? - Chris