I would like to highlight the search results, when using the filter toolbar.
I tried to use the solution Oleg and Abhishek Simon provided here, but it is not working in JqSuite for PHP.
grid.php code snippet
$highlighting = <<<HIGHLIGHTING
function () {
var filters, i, l, rules, rule, iCol, $this = $(this);
if (this.p.search === true) {
filters = $.parseJSON(this.p.postData.filters);
if (filters !== null && typeof filters.rules !== 'undefined' &&
filters.rules.length > 0) {
rules = filters.rules;
l = rules.length;
for (i = 0; i < l; i++) {
rule = rules[i];
iCol = getColumnIndexByName($this, rule.field);
if (iCol >=0) {
$('>tbody>tr.jqgrow>td:nth-child(' + (iCol + 1) +
')', this).highlight(rule.data);
}
}
}
}
}
HIGHLIGHTING;
$grid->setGridEvent('loadComplete',$highlighting);
I get this error:
Notice: Undefined variable: this
Are you able to get what I am doing wrong?
$this = $("#grid")[0]
– Luiseluiza