'How to implement dropdown cell for a specific column
I am trying to customize one of the columns to have dropdown cells that can show the status and to be able to change it, same Jira backlog issue status implementation.
the idea is to take the dropdown value and send it to my database via graphql.
can anyone advise me with the best practice to do it ?
below are my code
const [reqStatus, setreqStatus] = useState(false);
const result = orgData.map((a) => a.id);
console.log(result);
const handleTranslationstatus = (e) => {
e.preventDefault();
UpdateTransStatus({ stats: reqStatus, id: result })
.then((res) => {
console.log(res);
})
.catch((e) => {
alert(`Something went wrong, ${e.message}`);
});
};
const options = [
{ label: 'Progress', value: false },
{ label: 'Done', value: true },
];
<table className={style.table} id="myTable">
<thead className={style.header}>
<tr>
<th>orgName</th>
<th>VideoCardID</th>
<th>Requested Date</th>
<th>VideoLink</th>
<th>Request Status</th>
<th>save changes</th>
</tr>
</thead>
<tbody>
{orgData.map((organization) => {
return (
<tr key={organization.id}>
<td>{organization.orgName}</td>
<td>{organization.videocardId}</td>
<td>{organization.requestDate}</td>
<td>
<a target="_blank" href={`${organization.videoLink}`} rel="noreferrer">
Link
</a>
</td>
<td>
<Select
multi
value={reqStatus}
onChange={(e) => setreqStatus(e.target.value)}
options={options}
/>
</td>
<td>
<button
type="submit"
className="btn action-btn"
onClick={handleTranslationstatus}
>
Save
</button>
</td>
</tr>
);
})}
</tbody>
</table>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

