MCPcopy Index your code
hub / github.com/bvaughn/react-virtualized / _createColumn

Method _createColumn

source/Table/Table.js:455–611  ·  view source on GitHub ↗
({column, columnIndex, isScrolling, parent, rowData, rowIndex})

Source from the content-addressed store, hash-verified

453 }
454
455 _createColumn({column, columnIndex, isScrolling, parent, rowData, rowIndex}) {
456 const {onColumnClick} = this.props;
457 const {
458 cellDataGetter,
459 cellRenderer,
460 className,
461 columnData,
462 dataKey,
463 id,
464 } = column.props;
465
466 const cellData = cellDataGetter({columnData, dataKey, rowData});
467 const renderedCell = cellRenderer({
468 cellData,
469 columnData,
470 columnIndex,
471 dataKey,
472 isScrolling,
473 parent,
474 rowData,
475 rowIndex,
476 });
477
478 const onClick = event => {
479 onColumnClick && onColumnClick({columnData, dataKey, event});
480 };
481
482 const style = this._cachedColumnStyles[columnIndex];
483
484 const title = typeof renderedCell === 'string' ? renderedCell : null;
485
486 // Avoid using object-spread syntax with multiple objects here,
487 // Since it results in an extra method call to 'babel-runtime/helpers/extends'
488 // See PR https://github.com/bvaughn/react-virtualized/pull/942
489 return (
490 <div
491 aria-colindex={columnIndex + 1}
492 aria-describedby={id}
493 className={clsx('ReactVirtualized__Table__rowColumn', className)}
494 key={'Row' + rowIndex + '-' + 'Col' + columnIndex}
495 onClick={onClick}
496 role="gridcell"
497 style={style}
498 title={title}>
499 {renderedCell}
500 </div>
501 );
502 }
503
504 _createHeader({column, index}) {
505 const {
506 headerClassName,
507 headerStyle,
508 onHeaderClick,
509 sort,
510 sortBy,
511 sortDirection,
512 } = this.props;

Callers 1

renderMethod · 0.95

Calls 3

sortFunction · 0.85
onClickFunction · 0.85
cellRendererFunction · 0.70

Tested by

no test coverage detected