import * as React from 'react'; import JqxButton from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxbuttons'; import JqxCheckBox from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxcheckbox'; import JqxInput from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxinput'; import JqxProgressBar from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxprogressbar'; class App extends React.PureComponent<{}> { private myHorizontalProgressBar = React.createRef(); private myVerticalProgressBar = React.createRef(); private myInput = React.createRef(); private valueInput: number; private isUpdated: boolean; constructor(props: {}) { super(props); this.onClick = this.onClick.bind(this); this.onCheckBox = this.onCheckBox.bind(this); this.onCustomTextCheckBox = this.onCustomTextCheckBox.bind(this); this.getValueInput = this.getValueInput.bind(this); } public render() { return (
Horizontal
Vertical

Enter a value between 0 and 100
Update Show Progress Text Custom Progress Text
); } private renderText = (text: string): string => { return "" + text + ""; }; private getValueInput(): number { return parseInt(this.myInput.current!.getOptions('value'), 10); } private onClick(): void { const value = this.getValueInput(); if (!isNaN(value)) { this.valueInput = value; this.myHorizontalProgressBar.current!.val(value); this.myVerticalProgressBar.current!.val(value); this.isUpdated = true; } } private onCheckBox(event: any): void { const value = this.getValueInput(); if (value != null && this.isUpdated) { this.myHorizontalProgressBar.current!.val(this.valueInput); this.myVerticalProgressBar.current!.val(this.valueInput); } const isChecked = event.args.checked; this.myHorizontalProgressBar.current!.setOptions({ showText: isChecked }); this.myVerticalProgressBar.current!.setOptions({ showText: isChecked }); } private onCustomTextCheckBox(event: any): void { const value = this.getValueInput(); if (value != null && this.isUpdated) { this.myHorizontalProgressBar.current!.val(this.valueInput); this.myVerticalProgressBar.current!.val(this.valueInput); } if (event.args.checked) { this.myHorizontalProgressBar.current!.setOptions({ renderText: this.renderText }); this.myVerticalProgressBar.current!.setOptions({ renderText: this.renderText }); } else { this.myHorizontalProgressBar.current!.setOptions({ renderText: (text: string) => text }); this.myVerticalProgressBar.current!.setOptions({ renderText: (text: string) => text }); } } } export default App;