Get datatable's row data on button click

前端 未结 2 721
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 07:52

i have a problem with this project.

I\'m trying to create a crud menu, when hitting the Edit button the row\'s data will be transferred to a bootstrap modal and from the

2条回答
  •  迷失自我
    2021-02-06 08:38

    I would use a delegated event handler tbody .edit_btn and grab the row through closest('tr') :

    $('#example').on('click', 'tbody .edit_btn', function () {
        var data_row = table.row($(this).closest('tr')).data();
        ...
    })
    

    forked plunkr -> https://plnkr.co/edit/58vkkp3M6d68uuMknXus?p=preview

提交回复
热议问题