mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
reset method for property collapsible
This commit is contained in:
parent
1d184973f4
commit
9297f804fe
@ -61,7 +61,6 @@ let Form = React.createClass({
|
||||
},
|
||||
|
||||
reset() {
|
||||
console.log(this.refs);
|
||||
for(let ref in this.refs) {
|
||||
if (typeof this.refs[ref].reset === 'function'){
|
||||
this.refs[ref].reset();
|
||||
@ -106,12 +105,10 @@ let Form = React.createClass({
|
||||
data[this.refs[ref].props.name] = this.refs[ref].state.value;
|
||||
}
|
||||
|
||||
console.log(this.props);
|
||||
if (this.props.getFormData){
|
||||
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
return data;
|
||||
},
|
||||
|
||||
|
@ -4,6 +4,7 @@ import React from 'react';
|
||||
|
||||
import TextareaAutosize from 'react-textarea-autosize';
|
||||
|
||||
|
||||
let InputTextAreaToggable = React.createClass({
|
||||
propTypes: {
|
||||
editable: React.PropTypes.bool.isRequired,
|
||||
@ -17,14 +18,17 @@ let InputTextAreaToggable = React.createClass({
|
||||
value: this.props.defaultValue
|
||||
};
|
||||
},
|
||||
|
||||
handleChange(event) {
|
||||
this.setState({value: event.target.value});
|
||||
this.props.onChange(event);
|
||||
},
|
||||
|
||||
render() {
|
||||
let className = 'form-control ascribe-textarea';
|
||||
let textarea = null;
|
||||
if (this.props.editable){
|
||||
|
||||
if(this.props.editable) {
|
||||
className = className + ' ascribe-textarea-editable';
|
||||
textarea = (
|
||||
<TextareaAutosize
|
||||
@ -37,10 +41,10 @@ let InputTextAreaToggable = React.createClass({
|
||||
onBlur={this.props.onBlur}
|
||||
placeholder={this.props.placeholder} />
|
||||
);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
textarea = <pre className="ascribe-pre">{this.state.value}</pre>;
|
||||
}
|
||||
|
||||
return textarea;
|
||||
}
|
||||
});
|
||||
|
@ -42,6 +42,13 @@ let PropertyCollapsile = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
reset() {
|
||||
// If the child input is a native HTML element, it will be reset automatically
|
||||
// by the DOM.
|
||||
// However, we need to collapse this component again.
|
||||
this.setState(this.getInitialState());
|
||||
},
|
||||
|
||||
render() {
|
||||
let tooltip = <span/>;
|
||||
if (this.props.tooltip){
|
||||
|
Loading…
Reference in New Issue
Block a user