MCPcopy Create free account
hub / github.com/AllenFang/react-bootstrap-table / render

Method render

src/TableRow.js:79–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77 }
78
79 render() {
80 this.clickNum = 0;
81 const { selectRow, row, isSelected, className, index, hidden } = this.props;
82 let { style } = this.props;
83 let backgroundColor = null;
84 let selectRowClass = null;
85
86 if (selectRow) {
87 backgroundColor = Utils.isFunction(selectRow.bgColor) ?
88 selectRow.bgColor(row, isSelected) : ( isSelected ? selectRow.bgColor : null);
89
90 selectRowClass = Utils.isFunction(selectRow.className) ?
91 selectRow.className(row, isSelected) : ( isSelected ? selectRow.className : null);
92 }
93
94 if (Utils.isFunction(style)) {
95 style = style(row, index);
96 } else {
97 style = { ...style } || {};
98 }
99 // the bgcolor of row selection always overwrite the bgcolor defined by global.
100 if (style && backgroundColor && isSelected) {
101 style.backgroundColor = backgroundColor;
102 }
103 const trCss = {
104 style: { ...style },
105 className: classSet(selectRowClass, className)
106 };
107
108 return (
109 <tr { ...trCss }
110 onMouseOver={ this.rowMouseOver }
111 onMouseOut={ this.rowMouseOut }
112 onClick={ this.rowClick }
113 hidden={ hidden }
114 onDoubleClick={ this.rowDoubleClick }>{ this.props.children }</tr>
115 );
116 }
117}
118TableRow.propTypes = {
119 index: PropTypes.number,

Callers

nothing calls this directly

Calls 1

classSetFunction · 0.85

Tested by

no test coverage detected