
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
reactabular-sticky
Advanced tools
Sometimes you might want to display data within a fixed container. That's where reactabular-sticky comes in. It includes logic keeping a table header and a table body in sync. Unfortunately you still need to dig DOM references yourself to achieve this given it relies on measuring.
The API is exactly the same as for reactabular-table apart from naming. Here you need to use Sticky.Header and Sticky.Body over Table.Header and Table.Body.
The following example implements sticky headers within a fixed viewport through props.
/*
import React from 'react';
import { Table } from 'reactabular-table';
// import * as Sticky from 'reactabular-sticky';
import { generateRows } from './helpers';
*/
const schema = {
type: 'object',
properties: {
id: {
type: 'string'
},
name: {
type: 'string'
},
product: {
type: 'string'
},
company: {
type: 'string'
},
age: {
type: 'integer'
}
},
required: ['id', 'name', 'product', 'company', 'age']
};
const rows = generateRows(100, schema);
const columns = [
{
property: 'name',
props: {
style: { minWidth: 300 }
},
header: {
label: 'Name'
}
},
{
property: 'age',
props: {
style: { minWidth: 100 }
},
header: {
label: 'Age'
}
},
{
property: 'company',
props: {
style: { minWidth: 400 }
},
header: {
label: 'Company'
}
},
{
property: 'product',
props: {
style: { minWidth: 400 }
},
header: {
label: 'Product'
}
}
];
class StickyTable extends React.Component {
constructor(props) {
super(props);
this.state = {
rows,
columns
};
this.tableHeader = null;
this.tableBody = null;
}
componentDidMount() {
// We have refs now. Force update to get those to Header/Body.
this.forceUpdate();
}
render() {
const { rows, columns } = this.state;
return (
<Table.Provider
className="pure-table pure-table-striped"
columns={columns}
>
<Sticky.Header
style={{
maxWidth: 800
}}
ref={tableHeader => {
this.tableHeader = tableHeader && tableHeader.getRef();
}}
tableBody={this.tableBody}
/>
<Sticky.Body
rows={rows}
rowKey="id"
style={{
maxWidth: 800,
maxHeight: 400
}}
ref={tableBody => {
this.tableBody = tableBody && tableBody.getRef();
}}
tableHeader={this.tableHeader}
/>
</Table.Provider>
);
}
}
<StickyTable />
FAQs
Sticky header and body for Reactabular
The npm package reactabular-sticky receives a total of 1,707 weekly downloads. As such, reactabular-sticky popularity was classified as popular.
We found that reactabular-sticky demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.