var table = $("#table");
table.on('post-common-search.bs.table', function (event, table) {
var form = $("form", table.$commonsearch);
$("input[name='cpid']", form).addClass("selectpage").data("source", "gameset/getlist").data("primaryKey", "id").data("field", "name").data("orderBy", "id desc");
Form.events.cxselect(form);
Form.events.selectpage(form);
});
table.on('post-common-search.bs.table', function (event, table) {
var form = $("form", table.$commonsearch);
$("input[name='appid']", form).addClass("selectpage").data("source", "gameset/applist").data("primaryKey", "id").data("field", "name").data("orderBy", "id desc");
Form.events.cxselect(form);
Form.events.selectpage(form);
});
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
toolbar: false,
fixedColumns: true,
fixedRightNumber: 1,
showToggle: false,
showColumns: false,
// commonSearch: false,
showExport: false,
search: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'), operate: false},
{field: 'day', title: __('Day'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'cpid', title: '游戏', operate: 'LIKE'},
{field: 'appid', title:'包名', operate: 'LIKE'},
{field: 'money', title: __('Money'), operate: false},
{field: 'payuser', title: __('Payuser'), operate: false},
{field: 'reguser', title: __('Reguser'), operate: false},
{field: 'channel_id', title: '渠道', operate: false},
{field: 'paynum', title: __('Paynum'), operate: false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
参考:实现fastadmin搜索栏中动态下拉列表搜索功能 - 灰信网(软件开发博客聚合)
注意:里面的具体的字段根据业务需要调整