From e7589e4cc1f0bd1368aea8eb47f1007f34a328fc Mon Sep 17 00:00:00 2001 From: insanity Date: Sun, 28 May 2017 22:27:05 +0900 Subject: [PATCH] targetselector --- src/ts/containers/config/targetSelector.tsx | 48 ++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/ts/containers/config/targetSelector.tsx b/src/ts/containers/config/targetSelector.tsx index 143d885..8d4bdda 100644 --- a/src/ts/containers/config/targetSelector.tsx +++ b/src/ts/containers/config/targetSelector.tsx @@ -6,22 +6,22 @@ import Subheader from 'material-ui/Subheader'; import Checkbox from 'material-ui/Checkbox'; + let SelectableList = makeSelectable(List); -function wrapState(ComposedComponent: any, par : any) { +function wrapState(ComposedComponent: any, par: any) { return class SelectableList extends React.Component { - - constructor(props: any) { - super(props); - } componentWillMount() { this.setState({ - selectedIndex: this.props.defaultValue, + selectedIndex: -1, }); } handleRequestChange = (event: any, index: any) => { + this.setState({ + selectedIndex: index, + }); par.handleSelect(index); }; @@ -48,7 +48,7 @@ export class TargetSelector extends React.Component { SelectableList = wrapState(SelectableList, this); } - handleSelect(idx : any) { + handleSelect(idx: any) { this.props.onChange(idx); } @@ -56,37 +56,45 @@ export class TargetSelector extends React.Component { return (
- + Select a target to monitor , - , + , + , ]} />, , - , - ]} - />, - , + , + , ]} />, ]}