Skip to content

Commit 4af3ac1

Browse files
committed
fix grid glitch
1 parent b829088 commit 4af3ac1

File tree

3 files changed

+46
-42
lines changed

3 files changed

+46
-42
lines changed

apps/sensenet/src/components/content-list/content-list.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,15 +733,22 @@ export const ContentList = <T extends GenericContent = GenericContent>(props: Co
733733
setActiveContent(rowMouseEventHandlerParams.rowData)
734734
handleItemClick(rowMouseEventHandlerParams)
735735
},
736+
rowStyle: {
737+
position: 'static',
738+
top: 'auto',
739+
height: 'auto',
740+
overflow: 'initial',
741+
padding: '10px 0px',
742+
},
736743
onRowDoubleClick: onItemDoubleClickFunc,
737744
disableHeader: props.hideHeader,
738-
739-
740745
containerStyle: {
741746
height: '100%',
742747
display: 'flex',
743748
flexDirection: 'column',
744-
flexWrap: 'nowrap',
749+
overflowY: 'auto',
750+
maxHeight: '100%',
751+
paddingBottom: '15px',
745752
},
746753
}}
747754
/>

apps/sensenet/src/globalStyles.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export const useGlobalStyles = makeStyles((theme: Theme) => {
117117
},
118118
},
119119
virtualizedCellStyle: {
120-
height: '57px',
121120
width: '100%',
122121
padding: 0,
123122
},

packages/sn-list-controls-react/src/ContentList/virtualized-table.tsx

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
Table,
2121
TableCellProps,
2222
TableCellRenderer,
23+
TableProps,
2324
} from 'react-virtualized'
2425
import { ColumnSetting, ContentListBaseProps } from './content-list-base-props'
2526
import { ActionsCell, DateCell, ReferenceCell, RowCheckbox, VirtualDefaultCell, VirtualDisplayNameCell } from '.'
@@ -77,6 +78,39 @@ interface ExtendedGenericContent extends GenericContent {
7778
ColumnSettings?: string
7879
}
7980

81+
interface snTableProps extends Partial<TableProps> {
82+
/**
83+
* Number of rows in table.
84+
*/
85+
rowCount: number
86+
/**
87+
* Callback responsible for returning a data row given an index.
88+
* ({ index: number }): any
89+
*/
90+
rowHeight: number | ((params: Index) => number)
91+
/** Fixed height of header row */
92+
headerHeight: number
93+
/**
94+
* Callback responsible for returning a data row given an index.
95+
* ({ index: number }): any
96+
*/
97+
rowGetter: (info: Index) => any
98+
/**
99+
* Callback invoked when a user clicks on a table row.
100+
* ({ index: number }): void
101+
*/
102+
onRowClick?: (info: RowMouseEventHandlerParams) => void
103+
/**
104+
* Callback invoked when a user double-clicks on a table row.
105+
* ({ index: number }): void
106+
*/
107+
onRowDoubleClick?: (info: RowMouseEventHandlerParams) => void
108+
/**
109+
* Disable rendering the header at all
110+
*/
111+
disableHeader?: boolean
112+
}
113+
80114
interface VirtualizedTableProps<T extends GenericContent> extends ContentListBaseProps<T> {
81115
/**
82116
* Contains custom cell template components
@@ -94,43 +128,7 @@ interface VirtualizedTableProps<T extends GenericContent> extends ContentListBas
94128

95129
handleColumnSettingsClick?: () => void
96130

97-
tableProps: {
98-
autoHeight?: boolean
99-
100-
containerStyle?: React.CSSProperties
101-
102-
103-
/**
104-
* Number of rows in table.
105-
*/
106-
rowCount: number
107-
/**
108-
* Callback responsible for returning a data row given an index.
109-
* ({ index: number }): any
110-
*/
111-
rowHeight: number | ((params: Index) => number)
112-
/** Fixed height of header row */
113-
headerHeight: number
114-
/**
115-
* Callback responsible for returning a data row given an index.
116-
* ({ index: number }): any
117-
*/
118-
rowGetter: (info: Index) => any
119-
/**
120-
* Callback invoked when a user clicks on a table row.
121-
* ({ index: number }): void
122-
*/
123-
onRowClick?: (info: RowMouseEventHandlerParams) => void
124-
/**
125-
* Callback invoked when a user double-clicks on a table row.
126-
* ({ index: number }): void
127-
*/
128-
onRowDoubleClick?: (info: RowMouseEventHandlerParams) => void
129-
/**
130-
* Disable rendering the header at all
131-
*/
132-
disableHeader?: boolean
133-
}
131+
tableProps: snTableProps
134132
}
135133

136134
const minColumnWith = (field: keyof ExtendedGenericContent) => {
@@ -386,14 +384,14 @@ export const VirtualizedTable = <T extends GenericContent = GenericContent>(prop
386384
{({ height, width }) => (
387385
<>
388386
<Table
387+
{...tableProps}
389388
className={classes.root}
390389
height={height}
391390
width={width}
392391
gridStyle={{
393392
direction: 'inherit',
394393
outline: 'none',
395394
}}
396-
{...tableProps}
397395
rowClassName={getRowClassName}>
398396
{currentFieldsToDisplay.map((field) => {
399397
const currentField = field.field

0 commit comments

Comments
 (0)