bootstrap-table x-editable 插件,无法将类型设置为 select

bootstrap-table x-editable plugin, can't set type to select

我正在将 bootstrap-table 与 x-editable 插件一起使用,除了我无法更改 x 上的输入类型外,它大部分时间都在工作-editable 弹出窗口。我试过设置 data-type="select"type: 'select' 但它总是显示为类型 text

这个 fiddle 显示了问题,table 应该使用 select 类型但没有,table 之外的 link 与相同的选项确实有效。

<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'}
       ]
    });
});

https://jsfiddle.net/e3nk137y/2048/

Bootstrap table 目前不支持使用数据属性来初始化 x-editable 选项,您可以通过 JavaScript 代替。看这个例子:https://examples.bootstrap-table.com/#issues/986.html