@@ -147,11 +147,19 @@ class TableBody extends Component {
147147 this . props . expanding . indexOf ( key ) > - 1 ,
148148 ExpandColumnCustomComponent , r , data
149149 ) ;
150+ const haveExpandContent = this . props . expandableRow && this . props . expandableRow ( data ) ;
151+ const isExpanding = haveExpandContent && this . props . expanding . indexOf ( key ) > - 1 ;
152+
150153 // add by bluespring for className customize
151154 let trClassName = this . props . trClassName ;
152155 if ( isFun ( this . props . trClassName ) ) {
153156 trClassName = this . props . trClassName ( data , r ) ;
154157 }
158+ if ( isExpanding && this . props . expandParentClass ) {
159+ trClassName += isFun ( this . props . expandParentClass ) ?
160+ this . props . expandParentClass ( data , r ) :
161+ this . props . expandParentClass ;
162+ }
155163 const result = [ < TableRow isSelected = { selected } key = { key } className = { trClassName }
156164 index = { r }
157165 row = { data }
@@ -174,14 +182,17 @@ class TableBody extends Component {
174182 { tableColumns }
175183 </ TableRow > ] ;
176184
177- if ( this . props . expandableRow && this . props . expandableRow ( data ) ) {
185+ if ( haveExpandContent ) {
186+ const expandBodyClass = isFun ( this . props . expandBodyClass ) ?
187+ this . props . expandBodyClass ( data , r ) :
188+ this . props . expandBodyClass ;
178189 result . push (
179190 < ExpandComponent
180191 key = { key + '-expand' }
181192 row = { data }
182- className = { trClassName }
193+ className = { expandBodyClass }
183194 bgColor = { this . props . expandRowBgColor || this . props . selectRow . bgColor || undefined }
184- hidden = { ! ( this . props . expanding . indexOf ( key ) > - 1 ) }
195+ hidden = { ! isExpanding }
185196 colSpan = { expandColSpan }
186197 width = { "100%" } >
187198 { this . props . expandComponent ( data ) }
@@ -502,6 +513,8 @@ TableBody.propTypes = {
502513 expandBy : PropTypes . string ,
503514 expanding : PropTypes . array ,
504515 onExpand : PropTypes . func ,
516+ expandBodyClass : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . func ] ) ,
517+ expandParentClass : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . func ] ) ,
505518 onlyOneExpanding : PropTypes . bool ,
506519 beforeShowError : PropTypes . func ,
507520 keyBoardNav : PropTypes . oneOfType ( [ PropTypes . bool , PropTypes . object ] ) ,
0 commit comments