简体   繁体   中英

Material UI data grid filter not working when using renderCell in a field

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 } ]

Add 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

有人找到可能的解决方案吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM