|
<code>
class Hello extends App {
constructor(props) {
super(props);
};
private sportsData: string[] = ['Badminton', 'Cricket', 'Football', 'Golf', 'Tennis'];
// country DropDownList instance
private ddlObj: DropDownList;
componentWillMount() {
}
componentWillUnmount() {
// No Need
// this.ddlObj.destroy();
}
render() {
return (
<div id="component">
<DropDownListComponent id="ddlelement" ref={(scope) => { this.ddlObj = scope; }} dataSource={this.sportsData} placeholder="Select a game" />
</div>
);
}
}
</code> |
|
<Code>
export default class App extends React.Component< {}, {}> {
constructor(props) {
super(props);
}
public state: AppState = {
showChild: false
};
private dialogInstance: Dialog;
onOverlayClick() {
this.dialogInstance.hide();
this.setState({ showChild: false });
}
onClose() {
this.setState({ showChild: false });
}
onOpen() {
this.setState({ showChild: true });
}
//Bind the button click event
buttonClick() {
this.dialogInstance.show();
}
render() {
const { showChild } = this.state;
const childElement = showChild ? <Hello /> : null;
return (
<div id="container">
<DialogComponent id="dialog" isModal={true} header='DropDown' ref={dialog => this.dialogInstance = dialog} width= {'400px'}
target='#container' height= {'100%'} overlayClick={this.onOverlayClick.bind(this)} open={this.onOpen.bind(this)} close={this.onOpen.bind(this)} showCloseIcon = {true} >
<div className='content'>
<h4>DropDownList</h4>
{childElement}
</div>
</DialogComponent>
</div>
);
}
}
</Code> |