2021年1月22日星期五

React Ant design 4 Input search display table data

I'm tried to create Ant design 4 input search to filter data , Name and age, when i search name or age wanna display table data but its not working anyone know how to do that correctly

stazkblitz here

code here

const columns = [    {      title: "Name",      dataIndex: "name",      key: "name",      render: text => <a>{text}</a>    },    {      title: "Age",      dataIndex: "age",      key: "age"    }  ];    const data = [    {      key: "1",      name: "John Brown",      age: 32    },    {      key: "2",      name: "Jim Green",      age: 42    },    {      key: "3",      name: "Joe Black",      age: 32    }  ];  const onSearch = value => console.log(value);  ReactDOM.render(  <div><Search        placeholder="input search text"        allowClear        enterButton="Search"        size="large"        onSearch={onSearch}      />      <br/>         <br/>   <br/>      <Table columns={columns} dataSource={data} /></div>,      document.getElementById('container')     );  

Thanks

https://stackoverflow.com/questions/65850635/react-ant-design-4-input-search-display-table-data January 23, 2021 at 02:18AM

没有评论:

发表评论