Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
491 views
in Technique[技术] by (71.8m points)

reactjs - How can I add search functionality in datagrid material UI?

Here is my code looks like :

export default function FilterMenu() {

const [appState, setAppState] = useState({ loading: false,  rows: [] });
const [FilteredData, setFilteredData] = useState({ loading: false,  rows: [] });

const datasource = useEffect(() => {
  setAppState({ loading: true, rows : [] });
  const apiUrl = 'http://127.0.0.1:8000/api/requirement';
  axios.get(apiUrl).then((rows) => {
  
    setAppState({ loading: false, rows: rows.data });
    console.log(rows)
    rows = rows.data;
  });
}, [setAppState]);

console.log(appState.rows)

return(
 <>
 <div className="search">
 <TextField id="standard-basic" label="Search" style={{alignItems:'left'}}/>
 </div>
  <div style={{ height: 400, width: '95%', marginLeft:30}}>
   <DataGrid AllowPaging="true" PageSize="8" OnPageIndexChanging="stockTakeGrid_PageIndexChanging" rows={appState.rows} columns={columns} pageSize={5} checkboxSelection/>
   </div>
   </>
);

}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...