How to correctly enter the buttons in the table when using RESPONSIVE

How to correctly enter the buttons in the table when using RESPONSIVE

olvaolva Posts: 17Questions: 7Answers: 0
edited March 2022 in Responsive

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

Sign In or Register to comment.