[英]Scrollable table with fixed header and column as well as selective fixed rows
I need a table as shown in the image. 我需要一张如图所示的表格。
The requirements are: 要求是:
row-group heading row
) - "Title 1" and "Title 2" - will become fixed, below the header row, when all rows that belong to its group are in view. row-group heading row
)-“标题1”和“标题2”-将在标题行下方变为固定,当所有行属于它的团体在视野中。 And when we scroll further down, and when the next group of rows come into view, the previous row-group heading row
will go away and in its place (right below the fixed main header row) the row-group heading row
that corresponds to the rows in current view will be fixed. row-group heading row
消失,而在其位置(固定主标题行的正下方)的row-group heading row
对应的row-group heading row
当前视图中的行将被修复。 We're building a react app. 我们正在构建一个React应用。 We checked out: react-sticky-table , and other non-react libraries like: Stickytable and Sticky-kit .
我们检出了: react-sticky-table和其他非反应性库,例如: Stickytable和Sticky-kit 。
None of them seem to be doing what we want. 他们似乎都没有做我们想要的事情。
Is there a JS (react or non-react and preferably non-jquery) library that does this? 是否有执行此操作的JS(反应或非反应,最好是非jquery)库?
If not, assuming that we get the first-row header and the first column fixed using any of the above mentioned libraries, is there a way to make the row-group heading row
s fixed/static based on scrolling? 如果不是,假设我们使用上述任何一个库获取固定的第一行标题和第一列,是否可以通过滚动使
row-group heading row
s固定/静态?
I also prefer the table be built using <table>
group of elems, and not just divs. 我也更喜欢使用
<table>
组元素建立<table>
,而不仅仅是div。 But it's not a strict requirement. 但这不是严格的要求。
UPDATE: Just found this plugin that seems to be doing this: http://maslianok.github.io/stickyRows/multiplerows.html . 更新:刚发现此插件似乎正在执行此操作: http : //maslianok.github.io/stickyRows/multiplerows.html 。 It's great, but keeping this question open for pureJS or react solution.
很好,但是对于pureJS或react解决方案,请不要提出这个问题。
I have worked on the same UI but it was the mixture of pure javascript and jQuery, however less concerned about the front end library, as most of them fail at certain point of requirement or amount of data. 我曾在相同的UI上工作,但它是纯JavaScript和jQuery的混合体,但是对前端库的关注较少,因为它们中的大多数在某些需求或数据量时失败。 I suggest go with your own solution I did the same it is acceptable to clients since 5 years.
我建议您使用自己的解决方案,因为我做了5年以来一直被客户接受的解决方案。 1. Create a separate tables for your header and content.
1.为标题和内容创建一个单独的表。 2. Give each cloumn exactly same column span width.
2.给每个色谱柱完全相同的色谱柱跨度宽度。 Eg ,
<colspan width="50px">
3. Place a separate table with one column in LHS. 例如,
<colspan width="50px">
3.在LHS中放置一个带有一列的单独表。 4. Write a code in javascript which scrolls your LHS table along with your main table. 4.用javascript编写代码,该代码可将LHS表与主表一起滚动。
Apologies as it is hard to give working example. 抱歉,很难给出有效的例子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.