Skip to content Skip to sidebar Skip to footer

Datatable Cannot Click The Button After Pagination

I have done a datatable and custom it's data but when i click the button on the first column, it only works on the first page and cannot click on other forward pages. $('#tbl').Dat

Solution 1:

id's must be unique. We dont know your markup but

$('#tbl tbody tr #edit_current_product').delegate('a', 'click', function () 

seems utterly wrong. Either you have multiple <a>'s with the same id #edit_current_product or the right thing actually happens, you have paginated away from the page where #edit_current_product is present.

I guess that what you really want is

$('#tbl').on('click', 'tbody tr a', function() 

or use a class instead of an id

$('#tbl').on('click', 'tbody tr .edit_current_product', function() 

BTW, why

"columnDefs": [
    { "visible": false,  "targets": [ 6,7,8 ] }
],
"columns": [
    {},{"sClass": "dt-body-justify"},{},{},{},{},{},{},{},{}
]

you just need

"columnDefs": [
    { "visible": false,  "targets": [ 6,7,8 ] },
    { "sClass": "dt-body-justify", targets : [1] }
]

Post a Comment for "Datatable Cannot Click The Button After Pagination"