mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +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 }} />,
|
||||
onFilter: (value, record) =>
|
||||
record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()),
|
||||
record[dataIndex] ? record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()) : '',
|
||||
onFilterDropdownVisibleChange: visible => {
|
||||
if (visible) {
|
||||
setTimeout(() => this.searchInput.select());
|
||||
@ -94,7 +94,7 @@ class App extends React.Component {
|
||||
highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }}
|
||||
searchWords={[this.state.searchText]}
|
||||
autoEscape
|
||||
textToHighlight={text.toString()}
|
||||
textToHighlight={text ? text.toString() : ''}
|
||||
/>
|
||||
) : (
|
||||
text
|
||||
|
Loading…
Reference in New Issue
Block a user