wenzhixin引导表无法单击select2 [英] wenzhixin bootstrap-table unable to click on select2
问题描述
这是问题所在,并在Codeply中组合了一个样机 http://www.codeply.com/go/rxWzeVwBUa .
Here is the problem, and a put together a mockup in Codeply http://www.codeply.com/go/rxWzeVwBUa.
我无法在数据表中单击Select2下拉框.任何帮助将不胜感激.
I am unable to click on the Select2 dropdown box withing the datatable. Any help would be appreciated.
<div class="container">
<h1>From data</h1>
<p></p>
<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Item Name
<select class='table finditem'>
<option></option>
<option value='0'>Item 0</option>
...
</select>
</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
</div>
$table.bootstrapTable({
data: data});
});
$('#finditem').select2({
placeholder: 'Find Item',
allowClear: true
});
推荐答案
我将其发布到github上的开发人员中,并且开发人员发布了解决方案;
I posted this to the developer on github and the developer posted the solution;
https://github.com/wenzhixin/bootstrap-table/issues/1254#issuecomment-130358202 http://www.codeply.com/go/e4LJoKfhdR
$table.on('post-header.bs.table', function () {
$('.finditem').select2({
placeholder: 'Find Item',
allowClear: true
});
});
偶然地,我发现是否要使用任何select2事件侦听器,它们也必须放置在此函数中.我使用了一系列级联的select2框,当它们被选中时会自动更新表.
Incidentally I found out if you want to use any select2 event listeners they also have to be placed within this function also. I use a series of cascading select2 boxes to automatically update the table when they selected.
$table.on('post-header.bs.table', function () {
$('.finditem').select2({
placeholder: 'Find Item',
allowClear: true
});
$('.finditem').on('select2:close', function(){
$table.bootstrapTable('refresh');
});
});
这篇关于wenzhixin引导表无法单击select2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!