From b7dc3bd2b1d80db15492b96fc6775b3b4e91a73d Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Thu, 19 Sep 2019 20:46:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E4=B8=AD=E8=A1=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/editor/menu/window/RoleManageWindow.jsx | 16 +++++++++++++--- ShadowEditor.Web/src/ui/table/DataGrid.jsx | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ShadowEditor.Web/src/editor/menu/window/RoleManageWindow.jsx b/ShadowEditor.Web/src/editor/menu/window/RoleManageWindow.jsx index 27f6c893..872525a8 100644 --- a/ShadowEditor.Web/src/editor/menu/window/RoleManageWindow.jsx +++ b/ShadowEditor.Web/src/editor/menu/window/RoleManageWindow.jsx @@ -15,17 +15,21 @@ class RoleManageWindow extends React.Component { pageSize: 20, pageNum: 1, total: 0, + selected: null, }; this.update = this.update.bind(this); this.handleAdd = this.handleAdd.bind(this); this.handleEdit = this.handleEdit.bind(this); - this.renderStatus = this.renderStatus.bind(this); this.handleClose = this.handleClose.bind(this); + + this.renderStatus = this.renderStatus.bind(this); + + this.handleSelect = this.handleSelect.bind(this); } render() { - const { data, pageSize, pageNum, total } = this.state; + const { data, pageSize, pageNum, total, selected } = this.state; return - + @@ -84,6 +88,12 @@ class RoleManageWindow extends React.Component { renderStatus(value) { return value === 0 ? '启用' : '禁用'; } + + handleSelect(selected) { + this.setState({ + selected: selected.ID, + }); + } } export default RoleManageWindow; \ No newline at end of file diff --git a/ShadowEditor.Web/src/ui/table/DataGrid.jsx b/ShadowEditor.Web/src/ui/table/DataGrid.jsx index 3c2578e4..0a00300d 100644 --- a/ShadowEditor.Web/src/ui/table/DataGrid.jsx +++ b/ShadowEditor.Web/src/ui/table/DataGrid.jsx @@ -61,7 +61,7 @@ class DataGrid extends React.Component { } handleClick(onSelect, event) { - const keyField = this.props; + const keyField = this.props.keyField; const id = event.currentTarget.getAttribute('data-id'); const record = this.props.data.filter(n => n[keyField] === id)[0];