为什么 jqgrid、flexigrid 和 ingrid 都使用单独的表来存储标题和数据?
我们在 Web 应用程序上使用 jqgrid 来呈现搜索结果,因为它内置了在服务器端执行的分页和排序功能。我们之前使用过Tablesorter,但它是在客户端操作的,因此对于我们尝试使用它的方式来说效果不佳。
我们的项目中有一位网页设计师(他后来离开了该组织),他为表格创建了样式,并试图在 jqgrid 上获得相同的外观。这有点奏效,但不完全奏效。我们遇到标题列与数据列未对齐的问题。我们摆弄了CSS,但它似乎不起作用。有时,当我们不想要滚动条时,就会出现滚动条。
不管怎样,部分问题似乎是 jqgrid 使用一个表作为列标题,然后使用另一个表作为数据本身。这些表均包含在 div
标记中。我们已经研究了一些替代方案,例如 Flexigrid 和 Ingrid,但它们也使用相同的方法,对标题和数据使用单独的表格。
如果有人能解释为什么使用这种方法,那就太好了。我们想知道为什么不能使用带有 th
行作为标题和 td
作为数据的标准 table
标记?< /em>
We're using jqgrid on a web application to render the results of searches because of its built in functionality for paging and sorting that executes server side. We were previously using Tablesorter, but that operated client side and so didn't work well for how we were trying to use it.
We had a web designer on the project (whom has since left the organisation) that had created styles for tables and tried to get the same look working on the jqgrid. It sort of worked, but not quite. We have trouble with the header columns being unaligned with the data columns. We've fiddled with the CSS but it just doesn't seem to work. Sometimes we get scroll bars appearing when we don't want them.
Anyway, part of the problem seems to be that jqgrid uses one table for the column headers, and then another for the data itself. These tables are each wrapped in a div
tag. We've had a look at some of the alternatives such as Flexigrid and Ingrid but they also use the same approach with separate tables for the headers and data.
It would be great if someone could explain why this approach is used. We were wondering why a standard table
tag with a row of th
for the headers and td
for the data couldn't be used instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些插件使用单独的表来存储标题和数据的原因是允许固定标题滚动。据我所知,您不能在同一个表中包含标题和数据,但在滚动期间将标题固定到顶部。
另外,对于您的对齐问题,如果可能的话,我相信这些插件都有设置,您可以在其中设置每列的宽度,这将使数据和标题列正确对齐。
The reason these plugins use separate tables for headers and data is to allow for fixed header scrolling. As far as I know you cannot have headers and data in the same table, yet fix the headers to the top during scrolling.
Also for your alignment issue, if possible, I believe these plugins all have settings where you can set how wide you want each column, and this will make the data and header columns line up properly.