diff --git a/README.md b/README.md index bec0b21..c93ea9d 100644 --- a/README.md +++ b/README.md @@ -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? diff --git a/src/index.tsx b/src/index.tsx index 339ea60..897ba7c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -93,6 +93,7 @@ export interface IDataTableProps { title?: React.ReactNode, searchBtnText?: string, clearBtnText?: string, + actionText?: string, listSelectionBtnText?: string, /** 最大的表单项显示数,当表单项超过此数值时,会自动出现 collapse 按钮 */ maxVisibleFieldCount?: number, @@ -106,6 +107,8 @@ export interface IDataTableProps { /** reject handler */ onError? (err): void, rowSelection?: TableRowSelection, + /** 是否展示选择框列 */ + showSelectColumns?: boolean, affixTarget?: () => HTMLElement, affixOffsetTop?: number, affixOffsetBottom?: number @@ -173,10 +176,12 @@ export class DataTable extends React.Component 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 + readonly actionsColumn = this.props.rowActions && { key: 'actions', title: this.props.actionText, render: (record) => { return renderActions(this.props.rowActions as RowAction[], record) } } as TableColumnConfig readonly shouldShowTableTitle = this.props.title || this.props.enableListSelection @@ -349,14 +354,14 @@ export class DataTable extends React.Component } 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 && (