删除标题列中的一些特定单元格
Remove some Specific Cell in Head Column
目标:
仅显示名字、姓氏、年龄、访问、状态、个人资料进度列。
删除名为 'Name' 和 'Info'.
的单元格
总的来说,它将是包含 6 列作为头列的单行
问题:
我不习惯 react-table 我该怎么做?
Codesandbox:
https://codesandbox.io/s/exciting-ganguly-7w2d84
信息:
*新手 react-table
谢谢!
您只需更改标题栏的形状
const columns = React.useMemo(
() => [
{
Header: 'Name',
columns: [
{
Header: 'First Name',
accessor: 'firstName',
},
{
Header: 'Last Name',
accessor: 'lastName',
},
],
},
{
Header: 'Info',
columns: [
{
Header: 'Age',
accessor: 'age',
},
{
Header: 'Visits',
accessor: 'visits',
},
{
Header: 'Status',
accessor: 'status',
},
{
Header: 'Profile Progress',
accessor: 'progress',
},
],
},
],
[]
)
至此
const columns = React.useMemo(
() => [
{
Header: "First Name",
accessor: "firstName"
},
{
Header: "Last Name",
accessor: "lastName"
},
{
Header: "Age",
accessor: "age"
},
{
Header: "Visits",
accessor: "visits"
},
{
Header: "Status",
accessor: "status"
},
{
Header: "Profile Progress",
accessor: "progress"
}
],
[]
);
目标:
仅显示名字、姓氏、年龄、访问、状态、个人资料进度列。
删除名为 'Name' 和 'Info'.
的单元格
总的来说,它将是包含 6 列作为头列的单行
问题:
我不习惯 react-table 我该怎么做?
Codesandbox:
https://codesandbox.io/s/exciting-ganguly-7w2d84
信息:
*新手 react-table
谢谢!
您只需更改标题栏的形状
const columns = React.useMemo(
() => [
{
Header: 'Name',
columns: [
{
Header: 'First Name',
accessor: 'firstName',
},
{
Header: 'Last Name',
accessor: 'lastName',
},
],
},
{
Header: 'Info',
columns: [
{
Header: 'Age',
accessor: 'age',
},
{
Header: 'Visits',
accessor: 'visits',
},
{
Header: 'Status',
accessor: 'status',
},
{
Header: 'Profile Progress',
accessor: 'progress',
},
],
},
],
[]
)
至此
const columns = React.useMemo(
() => [
{
Header: "First Name",
accessor: "firstName"
},
{
Header: "Last Name",
accessor: "lastName"
},
{
Header: "Age",
accessor: "age"
},
{
Header: "Visits",
accessor: "visits"
},
{
Header: "Status",
accessor: "status"
},
{
Header: "Profile Progress",
accessor: "progress"
}
],
[]
);