I am using the jqwidget for grid in react.js. I have JqxListBox having a list of option in my parent component.
class ParentComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return <JqxListBox ref='myListBox' style={{ float: 'left' }} width={150} height={150} source={listBoxSource} checkboxes={true} />;
}
}
When user select or unselect some option in jqxlistbox i want to open show and hide coloumn in the grid but the refs is not accessed in child component. How to access the jqxlistbox property in child component react. In child componentDidMount function i'm accessing the ref like.
class ChildComponent extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
// Cannot read property 'on' of undefined
this.refs.myListBox.on('checkChange', (event) => {
console.log("something");
});
}
render() {
return <div>Child component</div>;
}
}
It give me the error : TypeError: Cannot read property 'on' of undefined