i have created one simple ag-grid using react js . after that i am call json data and pass data into ag-grid react table
actuall json data is :
{
"posts": [{
"cam1": " 3 persons, 1 car, 1 bottle, 2 chairs, 1 tv",
"cam2": " 1 person",
"date": "Tue, 19 April 12:16:29 ",
"status": "High"
}, {
"cam1": " 3 persons, 2 chairs, 1 tv",
"cam2": " 1 person",
"date": "Tue, 19 April 12:16:32 ",
"status": "Low"
}, {
"cam1": " 4 persons, 1 bottle, 2 chairs, 1 tv",
"cam2": " 1 person",
"date": "Tue, 19 April 12:16:35 ",
"status": "Medium"
}]
}
passing this json data into react table using json api call function.
const onGridReady=(params)=>{
console.log("grid is ready")
fetch("http://localhost:5000/posts").then(resp=>resp.json())
.then(resp=>{console.log(resp)
params.api.applyTransaction({add:resp})})
}
After passing data into react table. react table like
Now i wanna cell rendering function for status column in ag-grid table, with some of following conditions.
if status high indicates with red
if status medium indicated with yellow
else highlight with green background .
how to resolve this using react js, i expected output like this
for more code referece click Here
Thanks in advance