@@ -12,6 +12,7 @@ import { TableDataStore } from './store/TableDataStore';
1212import Util from './util' ;
1313import exportCSVUtil from './csv_export_util' ;
1414import { Filter } from './Filter' ;
15+ import TableHeaderColumn from './TableHeaderColumn' ;
1516
1617class BootstrapTable extends Component {
1718
@@ -162,37 +163,53 @@ class BootstrapTable extends Component {
162163 const rowIndex = column . props . row ? Number ( column . props . row ) : 0 ;
163164 const rowSpan = column . props . rowSpan ? Number ( column . props . rowSpan ) : 1 ;
164165 if ( ( rowSpan + rowIndex ) === ( rowCount + 1 ) ) {
165- return {
166- name : column . props . dataField ,
167- align : column . props . dataAlign ,
168- sort : column . props . dataSort ,
169- format : column . props . dataFormat ,
170- formatExtraData : column . props . formatExtraData ,
171- filterFormatted : column . props . filterFormatted ,
172- filterValue : column . props . filterValue ,
173- editable : column . props . editable ,
174- customEditor : column . props . customEditor ,
175- hidden : column . props . hidden ,
176- hiddenOnInsert : column . props . hiddenOnInsert ,
177- searchable : column . props . searchable ,
178- className : column . props . columnClassName ,
179- editClassName : column . props . editColumnClassName ,
180- invalidEditColumnClassName : column . props . invalidEditColumnClassName ,
181- columnTitle : column . props . columnTitle ,
182- width : column . props . width ,
183- text : column . props . headerText || column . props . children ,
184- sortFunc : column . props . sortFunc ,
185- sortFuncExtraData : column . props . sortFuncExtraData ,
186- export : column . props . export ,
187- expandable : column . props . expandable ,
188- index : i ,
189- attrs : column . props . tdAttr ,
190- style : column . props . tdStyle
191- } ;
166+ const columnDescription = this . getColumnDescription ( column ) ;
167+
168+ columnDescription . index = i ;
169+
170+ return columnDescription ;
192171 }
193172 } ) ;
194173 }
195174
175+ getColumnDescription ( column ) {
176+ let columnDescription = {
177+ name : column . props . dataField ,
178+ align : column . props . dataAlign ,
179+ sort : column . props . dataSort ,
180+ format : column . props . dataFormat ,
181+ formatExtraData : column . props . formatExtraData ,
182+ filterFormatted : column . props . filterFormatted ,
183+ filterValue : column . props . filterValue ,
184+ editable : column . props . editable ,
185+ customEditor : column . props . customEditor ,
186+ hidden : column . props . hidden ,
187+ hiddenOnInsert : column . props . hiddenOnInsert ,
188+ searchable : column . props . searchable ,
189+ className : column . props . columnClassName ,
190+ editClassName : column . props . editColumnClassName ,
191+ invalidEditColumnClassName : column . props . invalidEditColumnClassName ,
192+ columnTitle : column . props . columnTitle ,
193+ width : column . props . width ,
194+ text : column . props . headerText || column . props . children ,
195+ sortFunc : column . props . sortFunc ,
196+ sortFuncExtraData : column . props . sortFuncExtraData ,
197+ export : column . props . export ,
198+ expandable : column . props . expandable ,
199+ attrs : column . props . tdAttr ,
200+ style : column . props . tdStyle
201+ } ;
202+
203+ if ( column . type !== TableHeaderColumn && React . isValidElement ( column . props . children ) ) {
204+ columnDescription = {
205+ ...columnDescription ,
206+ ...this . getColumnDescription ( React . Children . only ( column . props . children ) )
207+ } ;
208+ }
209+
210+ return columnDescription ;
211+ }
212+
196213 reset ( ) {
197214 const { pageStartIndex } = this . props . options ;
198215 this . store . clean ( ) ;
0 commit comments