是否可以阻止 jqGrid 行被选择和/或突出显示?
我查看了 文档 但我无法寻找答案。有没有办法防止行在选择时突出显示?那甚至是一种完全停止选择行的方法。我喜欢“hoverrows: true”选项,但理想情况下我想阻止单击时选择一行。
谢谢,
更新: 我已经能够“粗暴地”实施一些似乎是临时修复的东西。我根本不喜欢它,并且理想地希望有一个更好的解决方案,如果有的话......
我发现,如果我
onSelectRow: function(rowid, status) {
$('#'+rowid).removeClass('ui-state-highlight');
}
在实例化 jqGrid 时传递该选项,我可以在添加它时删除突出显示。
还有另一种更理想的方法吗?
I've looked at the documentation but I've been unable to find an answer. Is there a way to prevent a row from being highlighted when selected? That or even a way to stop the row being selected at all. I like the "hoverrows: true" option, but ideally I would like to stop a row from being selected on-click.
Thanks,
Update:
I've been able to "hackily" implement something which seems to be an interim fix. I don't really like it at all and would idealy like a better solution, if there is one...
I have found that if I pass the option
onSelectRow: function(rowid, status) {
$('#'+rowid).removeClass('ui-state-highlight');
}
when I instantiate the jqGrid, I can strip the highlight when it is added.
Is there another, more ideal, way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用以下代码:
Use the following code:
如果您像我一样,拥有无数个 jqGrid,并且不想为每个 jqGrid 覆盖 onSelectRow,那么这里有一个 Reigel 解决方案的全局版本,对我来说效果很好:
If you, like me, have a gazillion jqGrids and don't want to override onSelectRow for every single one, here's a global version of Reigel's solution that worked nicely for me:
尝试:
您可以在此处阅读文档。希望它能帮助你...
try:
you can read documentations here. Hope it helps you...
我想你可以直接在 CSS 中解决这个问题。只需覆盖特定表的 ui-state-highlight 值即可。
我使用值
inherit
作为示例 - 您可能需要从 theme.css 复制一些值才能完成此操作。I suppose you could address this in the CSS directly. Just override the values for ui-state-highlight for your specific table
I used the value
inherit
just as an example - you will likely need to copy some values from your theme.css to make this work.是的,使用 rowattr 回调:
这也会使该行变灰并禁用选择。
Yes, use the rowattr callback:
This also grays out the row and disables the selection.