import * as React from 'react'; import JqxButton from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxbuttons'; import JqxPanel from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxpanel'; import JqxWindow from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxwindow'; class App extends React.PureComponent<{}, any> { private myWindow = React.createRef(); private events = React.createRef(); constructor(props: {}) { super(props); this.showWindowButtonClick = this.showWindowButtonClick.bind(this); this.eventWindowClose = this.eventWindowClose.bind(this); this.eventWindowMoved = this.eventWindowMoved.bind(this); this.eventWindowOpen = this.eventWindowOpen.bind(this); } public render() { return (
Show
Events Log:
Modal Window
Please click "OK", "Cancel" or the close button to close the modal window. The dialog result will be displayed in the events log.
OK Cancel
); } private capitaliseFirstLetter(word: string): string { return word.charAt(0).toUpperCase() + word.slice(1); }; private displayEvent(event: any): void { let eventData = 'Event: ' + this.capitaliseFirstLetter(event.type); if (event.type === 'moved') { eventData += ', X: ' + event.args.x + ', Y: ' + event.args.y; } if (event.type === 'close') { eventData += ', Dialog result: '; if (event.args.dialogResult.OK) { eventData += 'OK'; } else if (event.args.dialogResult.Cancel) { eventData += 'Cancel'; } else { eventData += 'None'; } } this.events.current!.prepend('
' + eventData + '
'); }; // Event handling private showWindowButtonClick(): void { this.myWindow.current!.open(); } private eventWindowClose(event: any): void { this.displayEvent(event); } private eventWindowMoved(event: any): void { this.displayEvent(event); } private eventWindowOpen(event: any): void { this.displayEvent(event); } } export default App;