fastadmin添加自定义按钮
1、首先在初始化表格参数配置中添加URL,添加所需要的按钮地址
2、然后再初始化表格中,这这个位置中添加按钮事件
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
buttons:[
{
name:'top',
text:'设为置顶',
title:'设为置顶',
classname: 'btn btn-xs btn-info btn-view btn-ajax',
icon: 'fa fa-arrow-up',
url: 'comment/top',
visible:function(row){
if(row.top_comment===0){
return true;
}else{
return false;
}
},
refresh:true
},
{
name:'unpink',
text:'取消置顶',
title:'取消置顶',
classname: 'btn btn-xs btn-warning btn-view btn-ajax',
icon: 'fa fa-arrow-down',
url: 'comment/unpink',
visible:function(row){
if(row.top_comment===1){
return true;
}else{
return false;
}
},
refresh:true
},
],formatter: Table.api.formatter.operate
}
这样就可以了,已经参加成功了。
博客:http://mylike.ltd
版权声明:本文为qq_37592047原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。