Hello all,
I am using jquery datatable and try to call function in jquery datatable from aspx page but cannot be able to bind datatable from that function .
Please help..
Following is my jquery Code
$(document).ready(function () {
if ($.fn.dataTable.isDataTable('#example')) {
t.destroy();
}
t = $("#example").DataTable({
processing: true,
serverSide: true,
info: true,
paging: true,
searching: true,
ajax: {
url: 'Search.aspx/BindDatatable',
data: function (data) {
delete data.columns;
}
},
columns: [
{ "data": "LibCode" },
{ "data": "LibName" },
{
"render": function (data, type, full, meta) {
return '<a class="btn btn-warning" onClick="editdata(' + full.LibCode + ',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\',\'' + full.LibCode + '\')" href="javascript://">Edit</a> <a class="btn btn-danger" onClick="deletePhantom(' + full.LibCode + ',\'DELETE\')" href="javascript://">Remove</a>';
}
}
],
order: [[0, 'desc']],
select: true,
dom: 'lfrtip',
responsive: true,
buttons: true
});
t.on('order.dt search.dt', function () {
t.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
});
and My aspx function is
[System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod()]
public static List<LibDetails> BindDatatable()
{
return PopulateCombo.BindDatatable();
}
What I have tried:
Please send any other code for jquery datatable with search and paging option