fix: default checkbox for row selection type

This commit is contained in:
chenos 2021-01-01 17:42:24 +08:00
parent 97136c62ba
commit 53212ee47d
2 changed files with 3 additions and 1 deletions

View File

@ -29,6 +29,7 @@ export function SimpleTable(props: SimpleTableProps) {
associatedKey, associatedKey,
isFieldComponent, isFieldComponent,
onSelected, onSelected,
multiple = true,
selectedRowKeys: srk, selectedRowKeys: srk,
} = props; } = props;
const { rowKey = 'id', name: viewName, actionDefaultParams = {}, fields = [], rowViewName, actions = [], paginated = true, defaultPerPage = 10 } = schema; const { rowKey = 'id', name: viewName, actionDefaultParams = {}, fields = [], rowViewName, actions = [], paginated = true, defaultPerPage = 10 } = schema;
@ -78,6 +79,7 @@ export function SimpleTable(props: SimpleTableProps) {
const tableProps: any = {}; const tableProps: any = {};
if (actions.length) { if (actions.length) {
tableProps.rowSelection = { tableProps.rowSelection = {
type: multiple ? 'checkbox' : 'radio',
selectedRowKeys, selectedRowKeys,
onChange, onChange,
} }

View File

@ -27,7 +27,7 @@ export function Table(props: TableProps) {
associatedKey, associatedKey,
isFieldComponent, isFieldComponent,
onSelected, onSelected,
multiple, multiple = true,
selectedRowKeys: srk, selectedRowKeys: srk,
} = props; } = props;
const { name: viewName, fields, actionDefaultParams = {}, defaultTabName, rowKey = 'id', actions = [], paginated = true, defaultPerPage = 10 } = schema; const { name: viewName, fields, actionDefaultParams = {}, defaultTabName, rowKey = 'id', actions = [], paginated = true, defaultPerPage = 10 } = schema;