bootstrap-table初始化配置

$('#table').bootstrapTable({
    toolbar: '#toolbar',
    search: true,
    formatSearch: function() {
        return '输入关键字';
    },
    height: $(document).height() - 40,
    pagination: true,
    sidePagination: 'server',
    pageList: [ 5, 10, 20 ],
    url: createUrl(""),
    striped: true,
    columns: [{
        radio: true
    },{
        title: '序号',
        field: 'index',
        formatter: formatterIndex
    },{
        field: 'goodsNo',
        title: '商品编号'
    },{
        field: 'goodsName',
        title: '商品名称'
    },{
        field: 'goodsType',
        title: '商品类型'
    },{
        field: 'brand',
        title: '品牌'
    },{
        field: 'isPutaway',
        title: '是否上架',
        formatter: formatterPutaway
    },{
        field: 'operate',
        title: '操作',
        formatter: formatterOperate
    }],
    queryParams: function (params) {
        params.pageSize = 1;
        params.pageNo = 10;
        params.keyword = params.search;
        return params;
    },
    responseHandler: function (res) {
        res.rows = res.rows;
        res.total = total;
        return res;
    }
});

注:不设置url参数的话会出现提示“正在努力地加载数据中,请稍候……”

你可能感兴趣的:(前端)