@@ -144,9 +144,7 @@ const useColumnSelector = (WrappedComponent: ComponentType<any>) => (
144144 { ...this . props }
145145 className = { `data-table-column-selector ${ this . props . className } ` }
146146 columns = { this . state . columns }
147- renderListHeader = { this . props . configurable
148- ? this . renderHeader . bind ( this )
149- : undefined }
147+ renderListHeader = { this . renderHeader . bind ( this ) }
150148 />
151149 ) ;
152150 }
@@ -157,45 +155,51 @@ const useColumnSelector = (WrappedComponent: ComponentType<any>) => (
157155 * @returns {* }
158156 */
159157 renderHeader ( ) {
158+ if ( ! ( this . props . configurable || this . props . renderListHeader ) ) {
159+ return null ;
160+ }
161+
160162 return (
161163 < >
162164 { this . props . renderListHeader && this . props . renderListHeader ( ) }
163- < Dropdown
164- aria-label = 'Select Columns'
165- basic
166- button
167- icon = 'cog'
168- className = 'icon configure-button open-right'
169- closeOnBlur = { false }
170- >
171- < Dropdown . Menu >
172- { this . state . columns
173- . filter ( ( c ) => c . label && c . label . length )
174- . map ( ( c , index ) => (
175- < Draggable
176- id = { c . name }
177- index = { index }
178- key = { c . name }
179- onDrag = { this . onDrag . bind ( this ) }
180- >
181- < Dropdown . Item
182- aria-dropeffect = 'move'
183- onClick = { ( e ) => e . stopPropagation ( ) }
165+ { this . props . configurable && (
166+ < Dropdown
167+ aria-label = 'Select Columns'
168+ basic
169+ button
170+ icon = 'cog'
171+ className = 'icon configure-button open-right'
172+ closeOnBlur = { false }
173+ >
174+ < Dropdown . Menu >
175+ { this . state . columns
176+ . filter ( ( c ) => c . label && c . label . length )
177+ . map ( ( c , index ) => (
178+ < Draggable
179+ id = { c . name }
180+ index = { index }
181+ key = { c . name }
182+ onDrag = { this . onDrag . bind ( this ) }
184183 >
185- < Icon
186- name = 'bars'
187- />
188- < Checkbox
189- aria-label = 'Select Column'
190- checked = { ! c . hidden }
191- label = { c . label }
192- onClick = { this . onColumnCheckbox . bind ( this , c ) }
193- />
194- </ Dropdown . Item >
195- </ Draggable >
196- ) ) }
197- </ Dropdown . Menu >
198- </ Dropdown >
184+ < Dropdown . Item
185+ aria-dropeffect = 'move'
186+ onClick = { ( e ) => e . stopPropagation ( ) }
187+ >
188+ < Icon
189+ name = 'bars'
190+ />
191+ < Checkbox
192+ aria-label = 'Select Column'
193+ checked = { ! c . hidden }
194+ label = { c . label }
195+ onClick = { this . onColumnCheckbox . bind ( this , c ) }
196+ />
197+ </ Dropdown . Item >
198+ </ Draggable >
199+ ) ) }
200+ </ Dropdown . Menu >
201+ </ Dropdown >
202+ ) }
199203 </ >
200204 ) ;
201205 }
0 commit comments