小编mar*_*ely的帖子

React JS-从渲染表中的行获取数据以编辑数据

我正在开发一种admon可以编辑ParseServer中存储的数据的方法。

我实现了一种搜索记录,过滤数据并再次重新呈现的方法。现在,我需要编辑获取的数据并通过UPDATE VERB更新记录。

在此处输入图片说明 如何获取行数据?例如console.log中的“Código”。

这是我的源代码:

render() {
    return (
     <table className="table table-hover table-bordered">
                                <thead>
                                <tr>
                                    <th scope="col"><center>Edit</center></th>
                                    <th scope="col"><center>#</center></th>
                                    <th scope="col"><center>Código</center></th>
                                    <th scope="col">Nombres</th>
                                    <th scope="col">Apellidos</th>
                                    <th scope="col">Grado</th>
                                </tr>
                                </thead>
                                <tbody id="cursorPointer">
                                   {/*Rendering data*/}
                                    {this.state.data.map(function(item, key) {
                                        return (
                                            <tr key = {key} >
                                                <td><center><button ... > Edit </button></center></td>
                                                <td><center>{item.objectId}</center></td>
                                                <td><center>{item.Codigo}</center></td>
                                                <td>{item.Nombres}</td>
                                                <td>{item.Apellidos}</td>
                                                <td>{item.Grado}</td>
                                            </tr>
                                        )
                                    })}
                                </tbody>
                            </table> 
  )
}
Run Code Online (Sandbox Code Playgroud)

任何的想法?

reactjs react-native

0
推荐指数
1
解决办法
3565
查看次数

标签 统计

react-native ×1

reactjs ×1