How to correctly enter the buttons in the table when using RESPONSIVE
How to correctly enter the buttons in the table when using RESPONSIVE
olva
Posts: 17Questions: 7Answers: 0
Help solve the huge issue of using responsive. The table has more than ten columns in the last two buttons - delete or edit. When using responsive at low resolutions (smartphone or tablet), they do not work and are not active. When you increase the resolution, when these buttons are on the computer monitor - they work. How to properly solve this problem. I give all the code in an abbreviated version. I would be grateful for any thoughts and ideas.
$(document).ready(function () {
var table = $('#example').DataTable({
responsive: true,
"ajax": "layouts/db_array",
"order": [[0, "desc"]],
"autoWidth": false,
"deferRender": true,
"columns": [
{"data": "pswd"},
{"data": "email", "width": "5%"},
{"data": "name"},
{"data": "last_name"},
{"data": "phone"},
{"data": "gender"},
{ "data": null,
"defaultContent": "
<a href=\"#\" data-toggle=\"modal\" role=\"button\" class=\" delete\" >"
"<span style=\"font-size: 1em; color: Tomato;\" title=\"Delete\"></span></a>
<a href=\"#\" role=\"button\" class=\" edit\" >"
"<span style=\"font-size: 1em; color: #0e148e;\" title=\"Edit\"></span></a>"
},
$('#example tbody').on('click', '.delete', function () {//click delete
var row = $(this).closest('tr');
$('#myModalBox').modal("show");
$('.elem').text('-' + ' ' + ' ' + name);
var url = "user_delete/" + data + "";
$("#twitter_user_delete").on('click', function () {
$(location).attr('href', url);
})
});
$('#example tbody').on('click', '.edit', function () {//click edit
var row = $(this).closest('tr');
var data = table.row(row).data().id;
var url = "user_edit/" + data + "";
$(location).attr('href', url);
});
});
html code standard
Answers
See if thisthread asking the same question helps. If not please provide a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin