我正在使用带有 x-editable 插件的 bootstrap-table,它主要工作,除了我无法更改 x-editable 弹出窗口上的输入类型。我试过设置data-type="select"
,type: 'select'
但它总是显示为类型text
这个小提琴显示了这个问题,表格应该使用选择类型但没有,表格外部具有相同选项的链接确实有效。
<table id="table-hover" data-toggle="table" data-show-toggle="true" data-show-columns="true" data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data1/">
<thead>
<tr>
<!-- this field doesn't show select input -->
<th data-field="name" data-editable="true" data-type="select">Name</th>
<th data-field="stargazers_count">Stars</th>
<th data-field="forks_count">Forks</th>
<th data-field="description">Description</th>
</tr>
</thead>
</table>
<!-- works! -->
<a href="#" id="fruits" data-type="select">banana</a>
js -
$(function () {
var $table = $('#table-hover');
$table.bootstrapTable({
}).on('editable-init.bs.table', function(e){
$('.editable').editable('option', {
type: 'select',
title: "Fruit",
source: [
{value: 1, text: 'banana'},
{value: 2, text: 'peach'}
]
});
});
$('#fruits').editable({
type: 'select',
title: "Fruit",
source: [
{value: 1, text: 'banana'},
{value: 2, text: 'peach'}
]
});
});