记录:fastadmin table固定表格操作栏 table属性:
fixedColumns: true,
fixedRightNumber: 1,
示例:
define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoregoods'], function ($, undefined, Backend, Table, Form,Template,litestoregoods) {
var Controller = {
index: function () {
$(".btn-add").data("area", ["1000px","800px"]);
Table.api.init({
extend: {
index_url: 'litestore/litestoregoods/index',
add_url: 'litestore/litestoregoods/add',
edit_url: 'litestore/litestoregoods/edit',
del_url: 'litestore/litestoregoods/del',
multi_url: 'litestore/litestoregoods/multi',
table: 'litestore_goods',
}
});
var table = $("#table");
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'goods_id',
sortName: 'goods_sort',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'goods_id', title: __('Goods_id')},
{field: 'goods_name',width:100, title: __('Goods_name')},
{field: 'category.name', title: __('Category.name')},
{field: 'category_id', visible:false,title: __('Category_id')},
{field: 'images', title: __('Images'), formatter: Table.api.formatter.images},
{field: 'spec_type', title: __('Spec_type'), searchList: {"10":__('Spec_type 10'),"20":__('Spec_type 20')}, formatter: Table.api.formatter.normal},
{field: 'deduct_stock_type', title: __('Deduct_stock_type'), searchList: {"10":__('Deduct_stock_type 10'),"20":__('Deduct_stock_type 20')}, formatter: Table.api.formatter.normal},
{field: 'sales_initial', title: __('Sales_initial')},
{field: 'sales_actual', title: __('Sales_actual')},
{field: 'goods_sort', title: __('Goods_sort')},
{field: 'flag', title: __('Flag'), searchList: {"discount":__('Discount')}, operate:'FIND_IN_SET', formatter: Table.api.formatter.label},
{field: 'goods_status', title: __('Goods_status'), searchList: {"10":__('Goods_status 10'),"20":__('Goods_status 20')}, formatter: Table.api.formatter.status},
{field: 'check_status', title: __('Check_status'), searchList: {"10":__('Check_status 10'),"20":__('Check_status 20')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
Table.api.bindevent(table);
table.on('load-success.bs.table',function(data){
$(".btn-editone").data("area", ["1000px","800px"]);
});
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
页面效果:
|