How to disable button within my DataTable?

How to disable button within my DataTable?

BradleyO07BradleyO07 Posts: 13Questions: 10Answers: 0

I am currently working on a data table that displays data I call. Above my table, the user has the ability to print off the table or turn the table into a pdf. I don't want to give the user have the options above the table. What can I add to my code below to allow this to not happen?

function getTable() {
  
  mainDT = $('#mainTable').DataTable( {
    display: 'envelope',
    ajax: {
      'type': 'POST',
      'url': './ajax/getData.ajax.php',
      'data': {
          'getTable': 1,
      }
    },
    table: ('#mainTable'),
    orderCellsTop: true,
    searching: true,
    paging: true,
    iDisplayLength: 25,
    scrollX: true,
    bInfo: true,
    dom:
      "<'row'<'col-12 col-sm-6 col-md-4 col-lg-3'l><'col-md-4 col-lg-6 d-none d-md-block text-center'B><'col-12 col-sm-6 col-md-4 col-lg-3'f>>" +
      "<'row'<'col-sm-12'tr>>" +
      "<'row'<'col-sm-5'i><'col-sm-7'p>>",
    columns: [
          { data: "createdby" },
          { data: "itemold" },
          { data: "itemnew"},
          { data: "enddatetime" },
          { data: null, render: function ( data, type, row) {
            return "<a class=\"default-link\" onClick=\"viewFile(" + data.uid + ")\"View/Edit</a>";
          } },
    ],
    fixedColumns: {
      leftColumns: 1
    },

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945
    Answer ✓

    This pare of the dom places the buttons above the table:

    <'col-md-4 col-lg-6 d-none d-md-block text-center'B>
    

    You can remove that code. Also, you don't show it, but you have a buttons definition somewhat that can be removed.

    Kevin

Sign In or Register to comment.