Cannot reinitialise DataTable
Cannot reinitialise DataTable

This is my code:
$(document).ready(function () {
var oTable = $('#example').DataTable({
"ajax": {
type: "POST",
url: "UserRoleServlet",
data: {SesCode: UsrSession, UserCode: UsrIdName, comid: UsrComId},
dataSrc: ""
},
"columns": [
{"data": "idIndex"},
{"data": "NAME"},
{
"data": null,
"mRender": function (data, type, full) {
return '<button onclick=loadEdit(' + (full.idIndex) + ')>Edit</button>';
}
}
]
});
});
}
$(document).ready(function () {
var table = $('#example').DataTable();
$('#example tbody').on('click', 'tr', function () {
var data = table.row(this).data();
alert('You clicked on ' + data[0] + '\'s row');
});
});
Error msg:
DataTables warning: table id=example - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
Help me to solve
Thanks
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
I need add click event to get cell data!
Try removing lines 21-23 so there's just a single
block.
Colin