【发布时间】:2021-01-22 17:21:41
【问题描述】:
不使用默认搜索栏,我想自定义如下:
- 在搜索栏前面添加一个按钮。
- 在搜索占位符中使用图标 (
<i className="fa fa-search"/>)。
到目前为止,这是我的代码:
import { Grid, _ } from 'gridjs-react';
const tableColumns = [
'Name',
'Phone',
{
name: 'Custom component',
formatter: (text) => _(<b>{text}</b>)
}
]
const tableData = [
['John', 12345, 'myText1'],
['Mike', 67891, 'myText2'],
]
export default function myCustomGrid() {
return (
<Grid
sort={true}
search={true} // This adds the search inp
columns={tableColumns}
data={tableData}
language={{
search: {
placeholder: '???? Search...'
}
}}
pagination={{
enabled: true,
limit: 2
}}
/>
);
}
【问题讨论】: