对于每个表列,我都有react-table
的类别ID数组,如何为此应用过滤器?
示例:
此一维数组易于过滤。
// 'status' data structure
let status = ['external', 'published', 'other status']
// column object
...
{
Header: 'Status',
accessor: 'status',
Filter: SimpleFilter,
},
...
如何过滤此二维数组?
let postsCategoryIds = [[1, 2], [1], [2, 3], [], [3]]
// If I choose 1, the result should be like this:
let result = [[1, 2], [1]]
// If I choose 2, the result should be like this:
let result = [[1, 2], [2, 3]]
// column object
...
{
Header: 'Categories',
accessor: 'category',
Filter: NotSoSimpleFilterGoesHere,
},
...