0

I'm using Ignited Datatables for viewing active users. What I want now is to have an Action column which I can disable the user. This is my code.

view:

<script type="text/javascript">
$(document).ready(function() {
    $('#users_table').dataTable({
        "sScrollX": "100%",
        "sScrollXInner": "100%",
        "sPaginationType": "full_numbers",
        "bProcessing": true,
        "bServerSide": true,
        "bJQueryUI": true,
        "bDeferRender": true,
        "sAjaxSource": "<?php echo base_url(); ?>/users/get_active_users",
        "sServerMethod": "POST",
        "aoColumnDefs": [{
            'bSortable': false,
            'aTargets': [7]
        }
        ]
    });
});
</script>
<thead>
  <tr>
     <th class="width70 text-center">Username</th>
     <th class="text-center">Full Name</th>
     <th class="text-center">Office</th>
     <th class="text-center">Position</th>
     <th class="text-center">Email</th>
     <th class="width60 text-center">Privilege</th>
     <th class="width160 text-center">Date Registered</th>
     <th class="width60 text-center">Actions</th>
  </tr>
</thead>
<tbody>
  <tr>
     <td colspan="7" class="dataTables_empty">Loading data from server</td>
  </tr>
</tbody>

1 Answer 1

1

with using ignited datatables you need to add action column in your datatables like

$this->datatables->add_column('action', '<a href="user/disable/$1">Disable User</a>', id);
Sign up to request clarification or add additional context in comments.

1 Comment

yes. there's a small typo in your code id should be inside the quote

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.