File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
packages/ra-ui-materialui/src/list/datatable Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -121,11 +121,10 @@ export const ColumnsSelector = ({ children }: ColumnsSelectorProps) => {
121121 setColumnRanks ( undefined ) ;
122122 setHiddenColumns ( defaultHiddenColumns ) ;
123123 } }
124- >
125- { translate ( 'ra.action.reset' , {
124+ label = { translate ( 'ra.action.reset' , {
126125 _ : 'Reset' ,
127126 } ) }
128- </ Button >
127+ / >
129128 </ Box >
130129 </ MenuList > ,
131130 container
Original file line number Diff line number Diff line change @@ -28,13 +28,14 @@ export const ColumnsSelectorItem = ({
2828 ) ;
2929 const columnFilter = useDataTableColumnFilterContext ( ) ;
3030 const translateLabel = useTranslateLabel ( ) ;
31- if ( ! source && ! label ) return null ;
31+ if ( ! source && ( ! label || typeof label !== 'string' ) ) return null ;
32+ const sourceOrLabel = source || ( label as string ) ;
3233 const fieldLabel = translateLabel ( {
3334 label : typeof label === 'string' ? label : undefined ,
3435 resource,
3536 source,
3637 } ) as string ;
37- const isColumnHidden = hiddenColumns . includes ( source ! ) ;
38+ const isColumnHidden = hiddenColumns . includes ( sourceOrLabel ! ) ;
3839 const isColumnFiltered = fieldLabelMatchesFilter ( fieldLabel , columnFilter ) ;
3940
4041 const handleMove = ( index1 , index2 ) => {
@@ -76,7 +77,7 @@ export const ColumnsSelectorItem = ({
7677 return isColumnFiltered ? (
7778 < FieldToggle
7879 key = { columnRank }
79- source = { source ! }
80+ source = { sourceOrLabel }
8081 label = { fieldLabel }
8182 index = { String ( columnRank ) }
8283 selected = { ! isColumnHidden }
You can’t perform that action at this time.
0 commit comments