如何修复 JQGrid 子网格中标题的位置?
我有一个子网格,子网格的高度设置为自动。
height:"auto"
在这里,当我向下滚动时,我需要修复标题的位置。但子网格没有滚动条。因为我不想在网格旁边有多个滚动条。只有一个滚动条。
提前致谢。
I've a sub-grid and height of sub-grid is set to auto.
height:"auto"
Here, I need to fix the position of headers, When i scroll down. But there is no scroll bar for sub-grid. Because i don't want multiple scroll bars in side my grid. Only one scroll bar.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果子网格的列标题在主网格滚动期间固定,则标题将与主网格下一行的包含内容重叠。无论如何都不可能如你所愿。
我可以建议您使用一个提示作为解决方法:如果鼠标光标位于子网格的单元格上,您可以覆盖显示的默认工具提示。默认工具提示与单元格包含的相同。您可以使用
cellattr
更改行为(请参阅答案和另一个作为示例)。子网格中的colModel
元素将显示文本“我的列名称”作为工具提示。我个人对所有具有
formatter: 'checkbox'
的列都使用这种方式。如果您有许多这样的列,并且您想检查网格中间的某些列,那么它有助于确定单元格属于哪一列。在你的情况下你也有同样的问题。因此,您可以使用该列的相同cellattr
属性。If the column headers of the subgrid will be fixed during scrolling of the main grid the headers will be overlapped with the contain of the next row of the main grid. In any way it is not possible what you want.
One tip as a workaround which I can suggest you: you can overwrite default tooltips shown if the mouse cursor is over the cells of subgrid. The default tooltips are the same as the cell contain. You can change behavior using
cellattr
(see the answer and another one as an example). ThecolModel
element in the subgrid havingwill display the text "My column name" as the tooltip. I personally use the way for all columns having
formatter: 'checkbox'
. If you have many such columns and you want to examine some column in the middle of grid then it helps to determine to which column the cell belongs. In your case you have the same problem. So you can use the samecellattr
property of the column.