Skip to content

Commit 2e2e5c3

Browse files
committed
add auto minWidth, props rowHeight
1 parent 8acf2ca commit 2e2e5c3

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ demo: https://flyingpath.github.io/react-virtualize-search-table
1111
| title | element or string | | table title |
1212
| columns | array | Y | Array of data object with dataKey and label [Example](#Columns) |
1313
| data | array | Y | Array of data object with element, searchKey and orderKey. [Example](#dataExample)
14+
| rowHeight | number | N | Height of row, default: 60
15+
1416

1517
### <a name="Columns"></a>columns
1618

src/components/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ class ReactVirtualizedSearchTable extends React.Component {
207207
}
208208
} )
209209

210+
const minWidth = columns.length * 80
211+
210212
return (
211-
<div className = { style.main } >
213+
<div className = { style.main } style = {{ minWidth: minWidth }} >
212214
<AutoSizer className = { style.autoSizer } style={ { height: '100%', width: '100%' } } >
213215
{({ height, width }) => {
214216
return (
@@ -222,7 +224,7 @@ class ReactVirtualizedSearchTable extends React.Component {
222224
width = { width - 2 }
223225
height = { height - 100 }
224226
headerHeight= { 70 }
225-
rowHeight = { 40 }
227+
rowHeight = { this.props.rowHeight || 60 }
226228
rowCount = { filterdData.length }
227229
rowRenderer = { this.rowRenderer }
228230
rowGetter = { ({ index }) => filterdData[index] }
@@ -280,6 +282,7 @@ ReactVirtualizedSearchTable.propTypes = {
280282
})
281283
)
282284
).isRequired,
285+
rowHeight: PropTypes.number
283286
}
284287

285288
export default ReactVirtualizedSearchTable

src/components/style.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.main {
2-
min-width: 700px;
32
height : 100%;
43
}
54

0 commit comments

Comments
 (0)