流程是当用户单击其中一个小部件时,表格应仅显示该类别的数据。
到目前为止,我已经实现了以下内容:
const columns = [
{
....
dataField: "Category",
formatter: formatCategory,
text: "Category",
sort: true,
filter: textFilter({
getFilter: (filter) => {
// nameFilter was assigned once the component has been mounted.
categoryFilter = filter;
}
})
....
}
处理按钮上的单击事件并传递类别:
const handleWidgetClick = (category) => {
categoryFilter = category;
// When I am doing something like this I am getting Uncaught Error
// categoryFilter is not a Function
categoryFilter(category)
};
我遵循了here
中的示例我不确定自己在哪里/什么地方做错了。 请指导我 谢谢
答案 0 :(得分:0)
<BootstrapTable
hover
bordered={false}
bootstrap4
keyField={"apps.App"}
**data={apps ? selectedCategory ?apps.filter((itm)=>{
return itm.Category === selectedCategory
}) :apps : no_Data}**
columns={columns}
filter={ filterFactory() }
noDataIndication={intl.formatMessage({ id: "GENERAL.NO_DATA" })}
/>