Click here to Skip to main content
15,887,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
the code is okay. But i want to highlight search word in datatable but could not do it. i tried ajax property in datatable but got error.

where and how can i do it?

Full code is uploaded there with database: https://drive.google.com/open?id=0BySGGgZO1jMVQVNDMmx1UWF1MlE

What I have tried:

$(document).ready(function () {


$('#jobSearchButton').click(function () {

$("#datatable").dataTable().api().destroy();

var empJob = $('#jobTitleTextBox').val();

$.ajax({
url: 'EmployeeService.asmx/GetEmployees',
data: { jobTitle: empJob },
dataType: 'json',
method: 'post',
success: function (data) {
$('#datatable').dataTable({
paging: true,
sort: true,
searching: true,
scrollY: 200,
data: data,
columns: [
{ 'data': 'Id' },
{ 'data': 'FirstName' },
{ 'data': 'LastName' },
{ 'data': 'Gender' },
{ 'data': 'JobTitle' },
{
'data': 'WebSite',
'sortable': false,
'searchable': false,
'render': function (webSite) {
if (!webSite) {
return 'N/A';
}
else {
return ''
+ webSite.substr(0, 10) + '...' + '
';
}
}
},
{
'data': 'Salary',
'render': function (salary) {
return "$" + salary;
}
},
{
'data': 'HireDate',
'render': function (jsonDate) {
var date = new Date(parseInt(jsonDate.substr(6)));
var month = date.getMonth() + 1;
return month + "/" + date.getDate() + "/" + date.getFullYear();
}
}
]
});
}


});

});
});
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900