$.ajax({
url: "/home/EventsNonReproList",
contentType: "application/json",
beforeSend: function () {
},
success: function (result) {
if (result.length > 0) {
listOfEventsNonRepro = result;
$('#example2').DataTable({
data: result,
deferRender: true,
scrollY: 400,
scrollCollapse: true,
scroller: true,
ordering: false,
//createdRow: function (row, data, index) {
// if (NonReproOnlyEvents.filter(x => x.sno == data.sno).length > 0) {
// $(row).addClass('red ' + data.sno);
// }
//},
search: {
"caseInsensitive": true
},
columns: [
{ "data": "sno" },
{ "data": "message" }
]
});
$("#example2_filter").hide();
}
}
});
// For search :
var table = $('#example').DataTable();
table.search($("#searchCriteria").val()).draw();
//Setting json from other ajax and settign to data object in DataTable :
var table2 = $('#example2').DataTable();
table2.data-yourJSON;
table2.draw();
No comments:
Post a Comment