mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 19:42:54 +08:00
docs: Update components/table/demo/custom-filter-panel.md (#25502)
Improved the quality of the sample code. Considered the case when the data does not exist. If the user searches, an error will be reported.
This commit is contained in:
parent
ef02b382b7
commit
1a692de9e2
@ -82,7 +82,7 @@ class App extends React.Component {
|
|||||||
),
|
),
|
||||||
filterIcon: filtered => <SearchOutlined style={{ color: filtered ? '#1890ff' : undefined }} />,
|
filterIcon: filtered => <SearchOutlined style={{ color: filtered ? '#1890ff' : undefined }} />,
|
||||||
onFilter: (value, record) =>
|
onFilter: (value, record) =>
|
||||||
record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()),
|
record[dataIndex] ? record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()) : '',
|
||||||
onFilterDropdownVisibleChange: visible => {
|
onFilterDropdownVisibleChange: visible => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
setTimeout(() => this.searchInput.select());
|
setTimeout(() => this.searchInput.select());
|
||||||
@ -94,7 +94,7 @@ class App extends React.Component {
|
|||||||
highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }}
|
highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }}
|
||||||
searchWords={[this.state.searchText]}
|
searchWords={[this.state.searchText]}
|
||||||
autoEscape
|
autoEscape
|
||||||
textToHighlight={text.toString()}
|
textToHighlight={text ? text.toString() : ''}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
text
|
text
|
||||||
|
Loading…
Reference in New Issue
Block a user