Hello team,
Is it possible to highlight the searched term in the doSearch function for a single search field on the grid?? For example, if I type 'ABCD' and if the data is present in the row object, then change the font color to red and background color to yellow of that matching cell.
The code is the same as the following link:
https://www.jeasyui.com/forum/index.php?topic=5537.0function doSearch(inp) {
var rows = [];
inp = inp.toUpperCase();
var l_pageSize = $('#dg').datagrid('options').pageSize;
if(!table_data.length || l_pageSize != g_pageSize)
{
getTableData();
}
$.map(table_data, function(row){
for(var p in row)
{
var v = row[p];
var regExp = new RegExp(inp, 'i'); // i - makes the search case-insensitive.
if(regExp.test(String(v)))
{
//will I have to manipulate the rows here???
rows.push(row);
break;
}
}
});
if(inp != "")
{
alert("Found records: " + rows.length);
$('#dg').datagrid('loadData', rows);
}
}
Thanks & Regards,
Darrel