MCPcopy Create free account
hub / github.com/Autodesk/react-base-table / rowRenderer

Function rowRenderer

website/src/examples/col-span.js:8–24  ·  view source on GitHub ↗
({ rowData, rowIndex, cells, columns })

Source from the content-addressed store, hash-verified

6columns[spanIndex].align = Column.Alignment.CENTER
7
8const rowRenderer = ({ rowData, rowIndex, cells, columns }) => {
9 const span = columns[spanIndex].colSpan({ rowData, rowIndex })
10 if (span > 1) {
11 let width = cells[spanIndex].props.style.width
12 for (let i = 1; i < span; i++) {
13 width += cells[spanIndex + i].props.style.width
14 cells[spanIndex + i] = null
15 }
16 const style = {
17 ...cells[spanIndex].props.style,
18 width,
19 backgroundColor: 'lightgray',
20 }
21 cells[spanIndex] = React.cloneElement(cells[spanIndex], { style })
22 }
23 return cells
24}
25
26export default () => (
27 <Table fixed columns={columns} data={data} rowRenderer={rowRenderer} />

Callers 2

renderRowFunction · 0.50
renderFrozenRowMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected