@@ -25,8 +25,6 @@ import Button from '@mui/material/Button';
2525import { extensionEnabled } from '../../utils/ReportUtils' ;
2626import { getCheckboxes , hasCheckboxes , updateCheckBoxes } from './TableActionsHelper' ;
2727
28- const TABLE_HEADER_HEIGHT = 32 ;
29- const TABLE_FOOTER_HEIGHT = 62 ;
3028const TABLE_ROW_HEIGHT = 52 ;
3129const HIDDEN_COLUMN_PREFIX = '__' ;
3230const theme = createTheme ( {
@@ -93,7 +91,6 @@ export const NeoTableChart = (props: ChartProps) => {
9391 const useStyles = generateClassDefinitionsBasedOnRules ( styleRules ) ;
9492 const classes = useStyles ( ) ;
9593 const tableRowHeight = compact ? TABLE_ROW_HEIGHT / 2 : TABLE_ROW_HEIGHT ;
96- const pageSizeReducer = compact ? 3 : 1 ;
9794
9895 const columnWidthsType =
9996 props . settings && props . settings . columnWidthsType ? props . settings . columnWidthsType : 'Relative (%)' ;
@@ -210,16 +207,14 @@ export const NeoTableChart = (props: ChartProps) => {
210207 ) ;
211208 } ) ;
212209
213- const availableRowHeight = ( props . dimensions . height - TABLE_HEADER_HEIGHT - TABLE_FOOTER_HEIGHT ) / tableRowHeight ;
214- const tablePageSize = compact
215- ? Math . round ( availableRowHeight ) - pageSizeReducer
216- : Math . floor ( availableRowHeight ) - pageSizeReducer ;
217-
218210 const pageNames = getPageNumbersAndNamesList ( ) ;
211+ const customStyles = { '&.MuiDataGrid-root .MuiDataGrid-footerContainer > div' : { marginTop : '0px' } } ;
212+
219213 const commonGridProps = {
220214 key : 'tableKey' ,
221- headerHeight : 32 ,
222- density : compact ? 'compact' : 'standard' ,
215+ columnHeaderHeight : 32 ,
216+ rowHeight : tableRowHeight ,
217+ autoPageSize : true ,
223218 rows : rows ,
224219 columns : columns ,
225220 columnVisibilityModel : columnVisibilityModel ,
@@ -235,11 +230,9 @@ export const NeoTableChart = (props: ChartProps) => {
235230 }
236231 } ,
237232 checkboxSelection : hasCheckboxes ( actionsRules ) ,
238- selectionModel : getCheckboxes ( actionsRules , rows , props . getGlobalParameter ) ,
239- onSelectionModelChange : ( selection ) => updateCheckBoxes ( actionsRules , rows , selection , props . setGlobalParameter ) ,
240- pageSize : tablePageSize > 0 ? tablePageSize : 5 ,
241- rowsPerPageOptions : rows . length < 5 ? [ rows . length , 5 ] : [ 5 ] ,
242- disableSelectionOnClick : true ,
233+ rowSelectionModel : getCheckboxes ( actionsRules , rows , props . getGlobalParameter ) ,
234+ onRowSelectionModelChange : ( selection ) => updateCheckBoxes ( actionsRules , rows , selection , props . setGlobalParameter ) ,
235+ disableRowSelectionOnClick : true ,
243236 components : {
244237 ColumnSortedDescendingIcon : ( ) => < > </ > ,
245238 ColumnSortedAscendingIcon : ( ) => < > </ > ,
@@ -322,15 +315,12 @@ export const NeoTableChart = (props: ChartProps) => {
322315 { ...commonGridProps }
323316 getRowHeight = { ( ) => 'auto' }
324317 sx = { {
325- '&.MuiDataGrid-root--densityCompact .MuiDataGrid-cell' : { py : '3px' } ,
326- '&.MuiDataGrid-root--densityCompact .MuiDataGrid-cell:has(button)' : { py : '0px' } ,
327- '&.MuiDataGrid-root--densityStandard .MuiDataGrid-cell' : { py : '15px' } ,
328- '&.MuiDataGrid-root--densityComfortable .MuiDataGrid-cell' : { py : '22px' } ,
318+ ...customStyles ,
329319 '&.MuiDataGrid-root .MuiDataGrid-cell' : { wordBreak : 'break-word' } ,
330320 } }
331321 />
332322 ) : (
333- < DataGrid { ...commonGridProps } rowHeight = { tableRowHeight } />
323+ < DataGrid { ...commonGridProps } sx = { customStyles } />
334324 ) }
335325 </ div >
336326 </ ThemeProvider >
0 commit comments