我想在使用筛选工具条时突出显示搜索结果。
我尝试使用Oleg和Abhishek Simon提供的解决方案here,但它在JqSuite for PHP中不起作用。
grid.php代码段
$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);我知道这个错误:
注意:未定义变量:this
你能明白我做错了什么吗?
发布于 2014-02-03 09:18:07
我自己不使用PHP。无论如何,您应该知道页面上使用的网格的ID。例如,如果是id="grid",那么可以在函数的代码中用$("#grid")[0]替换this。
https://stackoverflow.com/questions/21522699
复制相似问题