已成功将 JQGrid 用于几个项目,但在这个示例中努力让它执行我想要的操作。
我想我需要创建一个自定义 summaryType 来检查记录是否匹配,而不是 sum、avg、min、max 等。
我需要检查是否记录了“Us”,匹配了“Them”,并在红色 X 所在的位置显示了文本“Match”,谁能给我一些关于如何执行此操作的指示。
最佳答案
多亏了对此 answer 的评论,当您了解它的工作原理时,它会出奇地简单
the jqGrid will call your function for every row (this is why you pass it to the option only by name, jqGrid requires the actual function not its result) - for first row the val should be empty and for next rows it should be the result of previous call.
在你的colModel中设置一个summaryType作为你的函数名,然后使用这些函数
function numberMatch(val, name, record) {
if (val || 0 - record[name] == 0) {
return "Match";
} else {
return "unmatched";
}
}
function textMatch(val, name, record) {
if (val || '' === record[name]) {
return "Match";
} else {
return "unmatched";
}
}
关于javascript - JQGrid自定义汇总匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31431437/