admin管理员组文章数量:1134248
I am using the MUIX Datagrid and filters are not refreshing the Datagrid data after filtering in one of the columns of the DataGrid component.
Here is my DataGrid code:
const [dataRows] = useObservable(repository.allTransfers$);
const columns = [
{
field: "serviceId",
headerName: t("ID"),
width: 100,
filterable: true,
},
{ field: "date", headerName: t("Date") },
{ field: "vehicleType", headerName: t("Vehicle Type") },
{
field: "reference",
headerName: t("References"),
width: 365,
},
{ field: "code", headerName: t("Code") },
{
field: "action",
headerName: "Action",
width: 275,
sortable: false,
renderCell: (params: any) => {
const row = params.row as Row;
const onClickIntegrateWithExternalSystem = () => {
if (row) {
uploadTransferManifest(row);
}
};
if (row && row.integrationStatus !== INTEGRATED) {
return (
<>
<div>
<Button onClick={onClickIntegrateWithExternalSystem}>
{t("Integrate")}
</Button>
</div>
</>
);
}
},
},
{
field: "integrationStatus",
headerName: t("Integration Status"),
width: 155,
valueGetter: (params: any) => {
return t(params);
},
},
{
field: "integrationDate",
headerName: t("Integration Date"),
width: 140,
valueGetter: (params: any) => {
return params ? format(params, "yyyy-MM-dd HH:mm") : "";
},
},
{
field: "reference",
headerName: t("Reference"),
width: 300,
},
];
<DataGrid
rows={dataRows}
columns={columns}
disableColumnFilter={false}
pagination
rowCount={dataRows.length}
getRowId={() => uuidv4()}
getRowClassName={(params) =>
params.indexRelativeToCurrentPage % 2 === 0 ? "even" : "odd"
}
/>
I have searched in other articles for solutions but none of the solutions solved the problem.
Probably one of you may have passed through similar problems and can help out.
Info from version in package.json:
"@mui/x-data-grid": "^7.22.0"
Can you help?
Thanks
I am using the MUIX Datagrid and filters are not refreshing the Datagrid data after filtering in one of the columns of the DataGrid component.
Here is my DataGrid code:
const [dataRows] = useObservable(repository.allTransfers$);
const columns = [
{
field: "serviceId",
headerName: t("ID"),
width: 100,
filterable: true,
},
{ field: "date", headerName: t("Date") },
{ field: "vehicleType", headerName: t("Vehicle Type") },
{
field: "reference",
headerName: t("References"),
width: 365,
},
{ field: "code", headerName: t("Code") },
{
field: "action",
headerName: "Action",
width: 275,
sortable: false,
renderCell: (params: any) => {
const row = params.row as Row;
const onClickIntegrateWithExternalSystem = () => {
if (row) {
uploadTransferManifest(row);
}
};
if (row && row.integrationStatus !== INTEGRATED) {
return (
<>
<div>
<Button onClick={onClickIntegrateWithExternalSystem}>
{t("Integrate")}
</Button>
</div>
</>
);
}
},
},
{
field: "integrationStatus",
headerName: t("Integration Status"),
width: 155,
valueGetter: (params: any) => {
return t(params);
},
},
{
field: "integrationDate",
headerName: t("Integration Date"),
width: 140,
valueGetter: (params: any) => {
return params ? format(params, "yyyy-MM-dd HH:mm") : "";
},
},
{
field: "reference",
headerName: t("Reference"),
width: 300,
},
];
<DataGrid
rows={dataRows}
columns={columns}
disableColumnFilter={false}
pagination
rowCount={dataRows.length}
getRowId={() => uuidv4()}
getRowClassName={(params) =>
params.indexRelativeToCurrentPage % 2 === 0 ? "even" : "odd"
}
/>
I have searched in other articles for solutions but none of the solutions solved the problem.
Probably one of you may have passed through similar problems and can help out.
Info from version in package.json:
"@mui/x-data-grid": "^7.22.0"
Can you help?
Thanks
Share Improve this question edited Jan 8 at 15:00 Miguel Isidoro asked Jan 7 at 18:00 Miguel IsidoroMiguel Isidoro 514 bronze badges 1- Problem solved. The problem was the getRowId={() => uuidv4()}, that I replaced with getRowId={(row) => row.id} – Miguel Isidoro Commented Jan 8 at 18:58
1 Answer
Reset to default 0Updated code of datagrid, solved the issue
<DataGrid
rows={dataRows}
columns={columns}
disableColumnFilter={false}
pagination
rowCount={dataRows.length}
getRowId={(rowId) => rowId.id}
getRowClassName={(params) =>
params.indexRelativeToCurrentPage % 2 === 0 ? "even" : "odd"
}
/>
本文标签: reactjsReact MUI X Datagrid component filtering not workingStack Overflow
版权声明:本文标题:reactjs - React MUI X Datagrid component: filtering not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736784207a1952769.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论