@@ -13,7 +13,6 @@ export class Table extends React.Component {
1313 super ( props ) ;
1414
1515 this . state = {
16- parsedCustomComponents : false ,
1716 currentPage : 0 ,
1817 currentSort : {
1918 column : null ,
@@ -54,7 +53,7 @@ export class Table extends React.Component {
5453 }
5554
5655 parseChildData ( props ) {
57- let data = [ ] , tfoot , customComponentsCount = 0 ;
56+ let data = [ ] , tfoot ;
5857
5958 // Transform any children back to a data array
6059 if ( typeof ( props . children ) !== 'undefined' ) {
@@ -113,26 +112,19 @@ export class Table extends React.Component {
113112 __reactableMeta : true
114113 } ) ;
115114 break ;
116- default :
117- // Don't know if there are other acceptable types
118- // that should be dismissed
119- // console.log("Table, got custom component", child.type)
120- customComponentsCount ++ ;
121- break ;
122115 }
123116 } . bind ( this ) ) ;
124117 }
125118
126- return { data, tfoot, customComponentsCount } ;
119+ return { data, tfoot } ;
127120 }
128121
129122 initialize ( props ) {
130123 this . data = props . data || [ ] ;
131- let { data, tfoot, customComponentsCount } = this . parseChildData ( props ) ;
124+ let { data, tfoot } = this . parseChildData ( props ) ;
132125
133126 this . data = this . data . concat ( data ) ;
134127 this . tfoot = tfoot ;
135- this . customComponentsCount = customComponentsCount ;
136128
137129 this . initializeSorts ( props ) ;
138130 }
@@ -214,26 +206,6 @@ export class Table extends React.Component {
214206 this . sortByCurrentSort ( ) ;
215207 }
216208
217- componentDidMount ( ) {
218- for ( var i = 0 ; i < this . customComponentsCount ; i ++ ) {
219- let child = this . refs [ 'child-' + i ] ,
220- childData = child . getData ( ) ,
221- childDataToPush = { } ;
222- for ( var key in childData ) {
223- childDataToPush [ key ] = {
224- value : childData [ key ] ,
225- __reactableMeta : true
226- } ;
227- }
228- this . data . push ( {
229- data : childDataToPush ,
230- props : filterPropsFrom ( child . props ) ,
231- __reactableMeta : true
232- } ) ;
233- } ;
234- this . setState ( { parsedCustomComponents : true } ) ;
235- }
236-
237209 componentWillReceiveProps ( nextProps ) {
238210 this . initialize ( nextProps ) ;
239211 this . updateCurrentSort ( nextProps . sortBy ) ;
@@ -325,20 +297,8 @@ export class Table extends React.Component {
325297 this . setState ( { currentSort : currentSort } ) ;
326298 this . sortByCurrentSort ( ) ;
327299 }
328- renderUnparsedDataTable ( ) {
329- // http://www.mattzabriskie.com/blog/react-referencing-dynamic-children
330- let index = 0 ;
331- let children = React . Children . map ( this . props . children , function ( child ) {
332- return React . addons . cloneWithProps ( child , { ref : 'child-' + ( index ++ ) } ) ;
333- } ) ;
334-
335- return < div > { children } </ div > ;
336- }
337- render ( ) {
338- if ( ! this . state . parsedCustomComponents && this . customComponentsCount > 0 ) {
339- return this . renderUnparsedDataTable ( ) ;
340- }
341300
301+ render ( ) {
342302 let children = [ ] ;
343303 let columns ;
344304 let userColumnsSpecified = false ;
0 commit comments