我可以通过以下简单方法访问数据行:

$('#received-body tr').click( function(){
    aData = received_table.fnGetData(this);
    selected_received_id = aData[0];
    alert( selected_received_id );
});


但我无法通过其中之一的名为.received-update的按钮访问它们:

$('#received-body .received-update').click( function(){
    alert( 'update' ); // works
    aData = received_table.fnGetData( $(this).parents('tr')); // fails
    selected_received_id = aData[0];
    alert( 'update:' + selected_received_id );
});


任何帮助表示赞赏

最佳答案

您可以通过更换来解决您的问题

    aData = received_table.fnGetData($(this).parents('tr'));




    aData = received_table.fnGetData($(this).parents('tr')[0]);



调用received_table.fnGetPosition()时也需要相同的语法

关于jquery - 通过单击一行中的按钮来访问DataTable中的数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15437625/

10-11 04:13