mern - 如何使用 MERN 堆栈获取已在列表中选择的卡的 ID?
问题描述
我正在开发一个 CRM 应用程序,并且我设计了一个弹出窗口,其中所有员工姓名都在卡片中检索。此外,我使用 tabIndex 通过单击相应的卡来选择员工。我想知道如何获取所选员工的员工 ID。我为弹出和选择员工实现的代码如下:
<EmployeePopup trigger={buttonPopup} setTrigger={openPopup}>
<div>
<input
type="text"
placeholder="Search employees"
className="boxSearch"
onChange={e => setSearch(e.target.value)}>
</input>
<Searchicon/>
</div>
{filteredEmployees?.length >0?
<div className="employee-list">
{filteredEmployees.map(employee=>(
<div class="card-style card-header" tabIndex="-1" id={employee._id}>
{employee.firstName + " " + employee.lastName+" "}
{/* <input type="checkbox" id ={employee._id} value={employee.firstName + " " + employee.lastName} style={{float:"right", marginTop:"5px"}}/> */}
</div>
))}
</div>
:<div><i>No employees found</i></div>}
<div>
<button className="assign-btn">Assign</button>
</div>
</EmployeePopup>
解决方案
推荐阅读
- javascript - Javascript 正则表达式在 ArrayList 中搜索特定单词并在之前/之后打印单词
- vaadin - 没有 Spring 的 Vaadin 14 中的访问控制
- javascript - Req.body 不被解析,只返回 undefined
- python - 向 Flask App 发送和接收图像
- asp.net-mvc - 无法将 LinqToSQL (dbml) 添加到剃须刀页面项目
- python - 将python项目的所有使用过的包和版本保存在windows上的文本文件中?
- python - 尝试编写双向斐波那契数列,即偶数负数
- python - 当单元格为空时删除一行
- python - 删除 Pandas 中的列
- pandas - 是否可以仅使用阳性 covid 记录进行预测