admin管理员组文章数量:1332879
I am working in a react project and i am using Data Grid. There are several fields on that grid , the filter is working good with the other fields but not working with the field that use renderCell. Is there any way to filter the movie title? here is the code :
const columns = [
{ field: "_id", headerName: "ID", width: 110 },
{
field: "movie",
headerName: "Movie",
width: 240,
renderCell: (params) => {
return (
<div className={Style.usercell}>
<img src={params.row.featuredImg} alt="" />
<span>{params.row.title}</span>
</div>
);
},
},
{ field: "genre", headerName: "Genre", width: 120 },
{ field: "year", headerName: "Year", width: 120 } ]
I am working in a react project and i am using Data Grid. There are several fields on that grid , the filter is working good with the other fields but not working with the field that use renderCell. Is there any way to filter the movie title? here is the code :
const columns = [
{ field: "_id", headerName: "ID", width: 110 },
{
field: "movie",
headerName: "Movie",
width: 240,
renderCell: (params) => {
return (
<div className={Style.usercell}>
<img src={params.row.featuredImg} alt="" />
<span>{params.row.title}</span>
</div>
);
},
},
{ field: "genre", headerName: "Genre", width: 120 },
{ field: "year", headerName: "Year", width: 120 } ]
Share
Improve this question
asked Aug 28, 2021 at 6:05
Relex ModeRelex Mode
392 silver badges4 bronze badges
1
- possible duplicate of: stackoverflow./questions/68550751/… – Jeff Commented Nov 16, 2021 at 18:55
1 Answer
Reset to default 8Add this:
renderCell: (params) => {
return (
<div className={Style.usercell}>
<img src={params.row.featuredImg} alt="" />
<span>{params.row.title}</span>
</div>
);
},
valueGetter: (params) => params.row.title
本文标签: javascriptMaterial UI data grid filter not working when using renderCell in a fieldStack Overflow
版权声明:本文标题:javascript - Material UI data grid filter not working when using renderCell in a field - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742295709a2448679.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论