JQuery

[JQuery] datatable tr click event

chsr 2021. 11. 24. 10:31
728x90
반응형

■ JQuery datatable tr click event 


fnDrawCallback: function () { 
    $('#tableId tbody tr').click(function () {  
        // get position of the selected row  
        var position = $('#tableId').dataTable().fnGetPosition(this)  
        // value of the first column (can be hidden)  
        var id = $('#tableId').dataTable().fnGetData(position).id
        // redirect
        document.location.href = 'abcd.html?id=' + id
    })
}
728x90
반응형