1

EDIT :

I want to create a custom edit / delete function for records I have in a datatable.

In datatable code I have :

$('#users tbody').on( 'click', 'tr', function () {
     // get the row id here and send it to button 

} );

When a user selects a row I want to get the row ID and send it to a button :

<a href="<?php echo site_url('main/delete/$id')?>" data-toggle="modal" data-target="#deleteModel" role="button" class="btn-u btn-block">Delete</a>

$id (from the button link ) = ID of row selected by user.

4
  • This is a confusing question - It sounds like you want to add the id (of what?) to the hyperlink as a parameter - Is that correct? Commented Mar 10, 2015 at 16:44
  • Yes. Adding the id will allow me to call a function in a controller and from there to do the rest. Commented Mar 11, 2015 at 7:02
  • do you have the html view of your table? I have encountered same as this (custom edit and delete button).. And I have figured out a solution. But I am confused with your question.. Commented Mar 16, 2015 at 13:47
  • I have change the description on the question for better understanding. Commented Mar 17, 2015 at 12:57

1 Answer 1

1

For delete the answer can be found here :

Codeigniter + dataTable custom delete with bootstrap model

and for edit just add one more link in model.

Sign up to request clarification or add additional context in comments.

Comments

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.