import * as React from 'react'; import JqxListBox, { IListBoxProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxlistbox'; class App extends React.PureComponent<{}, IListBoxProps> { private myListBox = React.createRef(); private select = React.createRef(); private updating: boolean = false; constructor(props: {}) { super(props); this.change = this.change.bind(this); this.selectItem = this.selectItem.bind(this); } public componentDidMount() { this.myListBox.current!.loadFromSelect('select'); } public render() { return (
); } private change(event: any): void { this.updating = true; const index = this.select.current!.selectedIndex; this.myListBox.current!.selectIndex(index); this.myListBox.current!.ensureVisible(index); this.updating = false; }; private selectItem(event: any): void { if (event.args && !this.updating) { // select the item in the 'select' tag. const index = event.args.item.index; this.select.current!.selectedIndex = index; } }; } export default App;