Button Can't trigger.
Button Can't trigger.
Tidy.S
Posts: 3Questions: 1Answers: 0
I need some help. It's make me headache. I don't know what happen and what's wrong.
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#dataTables').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "script/server_processingmember.php",
"columnDefs": [ {
"targets": -1,
"data": null,
"defaultContent": "<button>Click!</button>"
} ]
} );
$('#dataTables tbody').on('click','button',function () {
var data = table.row( $(this).parents('tr') ).data();
window.location.href = "index.php?categ=edit&id="+ data[0];
} );
} );
</script>
<table id="dataTables">
<thead>
<tr>
<th width="5%">No.</th>
<th width="5%">Title</th>
<th width="15%">Name</th>
<th width="15%">Surname</th>
<th width="5%">Batch</th>
<th>ACTIVE</th>
<th>PAID</th>
<th>Others</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Thanks for your kind to help.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Does the console give any errors?
Possibly you are running into the issue described in this FAQ:
https://datatables.net/faqs/#Most-common-FAQs
Kevin
Dear Kevin
Thank you very much for your help. No error was shown. When i clicked on button. There is nothing response. I wish i will find the solution for it. I just want to put button on the table. When user click, it will jump to another page. Again, thank you very much for your kindness to answer my questions.
That really should be giving you an error in the console since you are using
$().dataTable()
which gives you a jQuery instance, but then attempting to use the DataTables API.Use
$().DataTable()
for the constructor, per the FAQ that Kevin linked to.Allan
Dear Mr.Kevin and Mr.Allan
Thank you very much for your help. As Mr.Allan said. I just change datatable() to DataTable(). For error message after read all informations from both of you provide. I have to use browser developing tools to view error and i found it.
Thank you very much.
Tidy