0
私は、テーブルの各select要素にonChangeイベントが関連付けられたReactコンポーネントを持っています。これらのselect要素には、select2 jqueryライブラリが動作しています。イベントは(コンソールにはエラーのいずれか)を発射しないされていない何らかの理由:React-onChangeイベントがselect2リストで起動しない
import select2 from 'meteor/natestrauser:select2';
export default class MyComponent extends React.Component {
constructor(props) {
super(props);
}
executeSelectedOption(e){
console.log("Worked!");
}
componentDidUpdate(){
$("select.js-example-placeholder-single").select2({
minimumResultsForSearch: Infinity
});
}
render() {
var results = this.props.data;
return (
<div>
<table>
<thead>
<tr>
<th>Title</th>
<th></th>
</tr>
</thead>
<tbody>
{results.map(function(d, index) {
return (
<tr key={d._id}>
<td>{d.title}</td>
<td>
<select onChange={this.executeSelectedOption.bind(this)} className="js-example-placeholder-single">
<option value="">...</option>
<option value="1">Do this</option>
<option value="2">Do that</option>
</select>
</td>
</tr>
)
}, this)}
</tbody>
</table>
</div>
);
}
}