如何在toolbar 渲染下拉菜单
悬赏:0F币
第一步 编写方法 第一个type 必须为dropdown
[pre]
dropdown:{
type: 'dropdown',
class: 'layui-btn-sm layui-btn-normal layui-icon layui-icon-down',
url: 'member.member/add',
icon: '',
text: __('More'),
title: __('Add'),
// full: 1,
width:'800',
height:'600',
extend:[{
class:'layui-btn-sm layui-btn-normal',
event:'open',
title:'测试1',
url:'member.member/add',
icon:'layui-icon layui-icon-edit',
},{
class:'layui-btn-sm layui-btn-normal',
event:'open',
title:'测试2',
url:'member.member/edit?id=1',
icon:'layui-icon layui-icon-wifi',
}]
},
[/pre]
第二步 在 toolbar 加入dropdown
[pre]
Table.render({
elem: '#' + Table.init.table_elem,
id: Table.init.tableId,
url: Fun.url(Table.init.requests.index_url),
init: Table.init,
toolbar: ['refresh','dropdown','add_full','destroy','export','recycle'],
cols: [[
{checkbox: true,},
{field: 'id', title: 'ID', width: 80, sort: true},
{field: 'username', title: __('memberName'), width: 120},
{field: 'email', title: __('Email'), width: 120,},
{field: 'mobile', title: __('mobile'), width: 120,edit: 'text'},
{
field: 'sex',
title: __('Sex'),
filter: 'sex',
width: 120,
search: 'select',
selectList: {0: __('Secret'), 1: __('Male'), 2: __('Female')},
templet: Table.templet.selects,
tips: __('Female')+'|'+ __('Male')
},
{
minwidth: 250,
align: 'center',
title: __('Operat'),
init: Table.init,
templet: Table.templet.operat,
operat: ['dropdown','edit_url', 'destroy']
}
]],
});
[/pre]
注意版本需要 2.4+