bootstrap x-editable某列启用编辑

//获取bootstrap构造器
    var BootstrapTable = $.fn.bootstrapTable.Constructor,
    _initTable = BootstrapTable.prototype.initTable;

    BootstrapTable.prototype.initTable = function () {
        var that = this;
        _initTable.apply(this, Array.prototype.slice.apply(arguments));

        if (!this.options.editable) {
            return;
        }
        $.each(this.columns, function (i, column) {
            if (!column.editable) {
                return;
            }
            column.formatter = function (value, row, index) {
                //满足一定条件直接返回value
                if (index == 0 || index == 6)
                {
                    return value;
                }
                return [',
                    ' data-name="' + column.field + '"',
                    ' data-pk="' + row[that.options.idField] + '"',
                    ' data-value="' + value + '"',
                    '>' + ''
                ].join('');
            };
        });
    };

效果如下:
bootstrap x-editable某列启用编辑_第1张图片

你可能感兴趣的:(bootstrap x-editable某列启用编辑)