后台动态生成 jquery easyui toolbar按钮

就是我想在后台动态的编写toolbar的各个参数,然后让前台按钮动态实现,求解答啊

toolbar : [{
id:'add',
iconCls : 'icon-add',
text : '添加权限',
handler : function() {
addSystem();
}
}, '-', {
iconCls : 'icon-edit',
text : '编辑权限',
iconAlign : 'left',
handler : function() {
updateSystem();
}
}, '-', {
iconCls : 'icon-remove',
text : '删除权限',
iconAlign : 'left',
handler : function() {
if (confirm("确定要删除吗")) {
deleteSystem();
} else {
return false;
}
}
}]

在后台直接把这段js输出到页面的脚本区。

如: 

<script type="text/javascript">
....
toolbar: <?php echo '你的json串'; ?>
....
</script>

温馨提示:内容为网友见解,仅供参考
第1个回答  2014-09-10
你是要更改生成几个按钮吗?还是连按钮的属性也要修改
第2个回答  2014-09-10
加个if判断啊 if管理员 write 所有权限追问

。。。。。?不明白

追答



无标题文档

$(document).ready(function(){
if($("#userName").val()=="管理员"){
$("#div1").append(" 我是管理员请给我所有权限.");
}
});

你是什么级别的?

追问

不是一个问题啊

追答

input 是后台给的当前用户的权限 不同的值得到不同的回答也就是按钮

本回答被提问者采纳
相似回答