import * as React from 'react'; import JqxInput, { IInputProps, jqx } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxinput'; class App extends React.PureComponent<{}, IInputProps> { private myInput = React.createRef(); private selectionLog = React.createRef(); constructor(props: {}) { super(props); this.myInputOnSelect = this.myInputOnSelect.bind(this); const source: any = { datafields: [ { name: 'CompanyName' }, { name: 'ContactName' } ], datatype: 'json', url: 'customers.txt' }; this.state = { source: new jqx.dataAdapter(source) } } public render() { return (

); } private myInputOnSelect(event: any): void { if (event.args) { const item = event.args.item; if (item) { const valueElement = document.createElement('div'); valueElement.innerHTML = 'Value: ' + item.value; const labelElement = document.createElement('div'); labelElement.innerHTML = 'Label: ' + item.label; const selectionLog = this.selectionLog.current!; selectionLog.innerHTML = ''; selectionLog.appendChild(labelElement); selectionLog.appendChild(valueElement); setTimeout(() => this.myInput.current!.val(item.label)); } } } } export default App;