【问题标题】:bootstrap-table x-editable plugin, can't set type to selectbootstrap-table x-editable 插件,不能设置类型来选择
【发布时间】:2015-06-10 13:02:40
【问题描述】:

我正在使用带有 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'}
       ]
    });
});

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

【问题讨论】:

    标签: x-editable bootstrap-table


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-04
      • 1970-01-01
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      • 2018-04-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多