这里面我利用bootdo设置了权限,根据权限显示不同的按钮,同时我需要在外面显示一个按钮,倒三角内显示下拉按钮;
{
title: '操作',
field: 'id',
align: 'left',
formatter: function (value, row, index) {
var a = '<a href="#" mce_href="#" ' +
'onclick="read(\'' + row.id + '\',\'' + row.type + '\')" class=" '+s_read_h+'"><i class="btn btn-info btn-xs" >详情</i></a> ';
var b = '<a href="#" mce_href="#" onclick="read2(\''
+ row.id
+ '\')" class=" '+s_read2_h+'"><i class="btn btn-info btn-xs">详情2</i></a> ';
var c = '';
var g = '';
var h = '';
if (row.s2== 1) {
c += '<a href="#" mce_href="#" ' +
'onclick="edit(\'' + row.s2 + '\',\'' + row.type2 + '\')" class=" '+s_read3_h+'"><i class="btn btn-info btn-xs">详情3</i></a> ';
} else {
if (...) {
if (...) {
c += ...
} else {
c += ...
}
h += ...
} else {
g += ...
}
}
var d= ...
var e= ...
var f = ...
var menu = '<div class="btn-group " ><nobr>'+
'<button data-toggle="dropdown" class="btn btn-info btn-xs dropdown-toggle " onclick="" >' +
'<span class="caret" ></span> ' +
'<span class="sr-only">Toggle Dropdown</span>'+
'</button> ' +
'<ul class="dropdown-menu" role="menu" >' +
'<li>'+b+'</li> ' +
'<li>'+c+'</li> ' +
'<li>'+d+'</li> ' +
'<li>'+e+'</li> ' +
'<li>'+f+'</li> ' +
'<li>'+g+'</li> ' +
'<li>'+h+'</li> ' +
' </ul>' +
'</nobr></div>';
if(s_read_h =='hidden' && s_read2_h =='hidden' && s_read3_h =='hidden' && ...){
return ;
}else if( s_read2_h =='hidden' && s_read3_h =='hidden' &&...){
return a;
}else{
return a+menu;
}
}
}]