Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,14 @@ Pixels to offset from top when calculating position of scroll

Pixels to offset from bottom when calculating position of scroll

### `showSelectColumns?`: boolean

show select columns or not, default is true

### `actionText:` string

action header title, default is 'Action'

## FAQ

### How to trigger the `onSearch` action imperatively?
Expand Down
13 changes: 9 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export interface IDataTableProps {
title?: React.ReactNode,
searchBtnText?: string,
clearBtnText?: string,
actionText?: string,
listSelectionBtnText?: string,
/** 最大的表单项显示数,当表单项超过此数值时,会自动出现 collapse 按钮 */
maxVisibleFieldCount?: number,
Expand All @@ -106,6 +107,8 @@ export interface IDataTableProps {
/** reject handler */
onError? (err): void,
rowSelection?: TableRowSelection<any>,
/** 是否展示选择框列 */
showSelectColumns?: boolean,
affixTarget?: () => HTMLElement,
affixOffsetTop?: number,
affixOffsetBottom?: number
Expand Down Expand Up @@ -173,10 +176,12 @@ export class DataTable extends React.Component<IDataTableProps, IDataTableState>
pageSize: 10,
searchBtnText: 'Search',
clearBtnText: 'Clear',
listSelectionBtnText: 'List selection'
listSelectionBtnText: 'List selection',
showSelectColumns: true,
actionText: 'Action'
}

readonly actionsColumn = this.props.rowActions && { key: 'actions', title: 'Actions', render: (record) => { return renderActions(this.props.rowActions as RowAction[], record) } } as TableColumnConfig<any>
readonly actionsColumn = this.props.rowActions && { key: 'actions', title: this.props.actionText, render: (record) => { return renderActions(this.props.rowActions as RowAction[], record) } } as TableColumnConfig<any>

readonly shouldShowTableTitle = this.props.title || this.props.enableListSelection

Expand Down Expand Up @@ -349,14 +354,14 @@ export class DataTable extends React.Component<IDataTableProps, IDataTableState>
}

render () {
const rowSelection = Object.assign({}, {
const rowSelection = this.props.showSelectColumns ? Object.assign({}, {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
selectedRowKeys, selectedRows
})
}
}, this.props.rowSelection)
}, this.props.rowSelection) : undefined

const ActionPanel = this.props.plugins && (
<Row className='operationpannel' gutter={16} type='flex' style={{ paddingBottom: '1em' }}>
Expand Down