From e2a99f53f7a27bd7de4adf99d0e1ee755b537c72 Mon Sep 17 00:00:00 2001 From: sojournerc Date: Tue, 20 Jun 2017 17:29:46 -0600 Subject: [PATCH] add ClickEvent to Table.props.onRowClick interface --- components/table/Table.tsx | 2 +- components/table/index.en-US.md | 10 +++++----- components/table/index.zh-CN.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index a888f6896a..4cfdbdb30e 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -80,7 +80,7 @@ export interface TableProps { loading?: boolean | SpinProps; locale?: Object; indentSize?: number; - onRowClick?: (record: T, index: number) => any; + onRowClick?: (record: T, index: number, event: Event) => any; useFixedHeader?: boolean; bordered?: boolean; showHeader?: boolean; diff --git a/components/table/index.en-US.md b/components/table/index.en-US.md index dc5be4c4eb..32f3ff302e 100644 --- a/components/table/index.en-US.md +++ b/components/table/index.en-US.md @@ -69,7 +69,7 @@ const columns = [{ | loading | loading status of table | boolean | false | | locale | i18n text include filter, sort, empty text...etc | object | filterConfirm: 'Ok'
filterReset: 'Reset'
emptyText: 'No Data'
[Default](https://github.com/ant-design/ant-design/issues/575#issuecomment-159169511) | | indentSize | index pixel size of tree data | number | 15 | -| onRowClick | callback that is called when click a row | Function(record, index) | - | +| onRowClick | callback that is called when click a row | Function(record, index, event) | - | | bordered | whether to show table border completely | boolean | false | | showHeader | whether to show table header | boolean | true | | footer | table footer renderer | Function(currentPageData) | | @@ -78,12 +78,12 @@ const columns = [{ ### Column -One of Property `columns` for descriping column, Column has the same API. +One of Property `columns` for describing column, Column has the same API. | Property | Description | Type | Default | |---------------|--------------------------|-----------------|--------------| | title | title of this column | string\|ReactNode | - | -| key | key of this column, you can ignore thie prop if you've set a unique `dataIndex` | string | - | +| key | key of this column, you can ignore this prop if you've set a unique `dataIndex` | string | - | | dataIndex | display field of the data record, could be set like `a.b.c` | string | - | | render | renderer of table cell, has three params: text, record and index of this row. The render value should be a ReactNode, or a object for [colSpan/rowSpan config](#demo-colspan-rowspan) | Function(text, record, index) {} | - | | filters | filter menu config | object[] | - | @@ -93,7 +93,7 @@ One of Property `columns` for descriping column, Column has the same API. | filterDropdownVisible | whether filterDropdown is visible | boolean | - | | onFilterDropdownVisibleChange | called when filterDropdownVisible is changed | function(visible) {} | - | | filteredValue | controlled filtered value, filter icon will highlight. | string[] | - | -| filtered | whether the dataSource is filterd | boolean | false | +| filtered | whether the dataSource is filtered | boolean | false | | filterIcon | customized filter icon | ReactNode | false | | sorter | sort function for local sort, see [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)'s compareFunction. If you need sort buttons only, set it `true` | Function\|boolean | - | | colSpan | span of this column's title | number | | @@ -168,7 +168,7 @@ class NameColumn extends Table.Column {} ## Note -According to [React documentation](https://facebook.github.io/react/docs/lists-and-keys.html#keys), every child in array should be assigned a unique key. The value inside `dataSource` and `columns` should follow this in Table, and `dataSource[i].key` would be treated as key value defaultly for `dataSource`. +According to [React documentation](https://facebook.github.io/react/docs/lists-and-keys.html#keys), every child in array should be assigned a unique key. The value inside `dataSource` and `columns` should follow this in Table, and `dataSource[i].key` would be treated as key value default for `dataSource`. If `dataSource[i].key` is not existed, then you should specify the primary key of dataSource value via `rowKey`. If not, warnings like above will show in browser console. diff --git a/components/table/index.zh-CN.md b/components/table/index.zh-CN.md index 9c28e9e327..e0d7821d78 100644 --- a/components/table/index.zh-CN.md +++ b/components/table/index.zh-CN.md @@ -70,7 +70,7 @@ const columns = [{ | loading | 页面是否加载中 | boolean | false | | locale | 默认文案设置,目前包括排序、过滤、空数据文案 | object | filterConfirm: '确定'
filterReset: '重置'
emptyText: '暂无数据'
[默认值](https://github.com/ant-design/ant-design/issues/575#issuecomment-159169511) | | indentSize | 展示树形数据时,每层缩进的宽度,以 px 为单位 | number | 15 | -| onRowClick | 处理行点击事件 | Function(record, index) | - | +| onRowClick | 处理行点击事件 | Function(record, index, event) | - | | bordered | 是否展示外边框和列边框 | boolean | false | | showHeader | 是否显示表头 | boolean | true | | footer | 表格尾部 | Function(currentPageData) | |