@@ -12,6 +12,7 @@ import { TableDataStore } from './store/TableDataStore';
12
12
import Util from './util' ;
13
13
import exportCSVUtil from './csv_export_util' ;
14
14
import { Filter } from './Filter' ;
15
+ import TableHeaderColumn from './TableHeaderColumn' ;
15
16
16
17
class BootstrapTable extends Component {
17
18
@@ -162,37 +163,53 @@ class BootstrapTable extends Component {
162
163
const rowIndex = column . props . row ? Number ( column . props . row ) : 0 ;
163
164
const rowSpan = column . props . rowSpan ? Number ( column . props . rowSpan ) : 1 ;
164
165
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 ;
192
171
}
193
172
} ) ;
194
173
}
195
174
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
+
196
213
reset ( ) {
197
214
const { pageStartIndex } = this . props . options ;
198
215
this . store . clean ( ) ;
0 commit comments