![]() |
1.Supcan Report允许自定义的工具条; 2.工具条中的“结算”、“贸易”和Report毫无关系,点击后将触发页面事件; 3.鼠标右键弹出菜单中有自定义菜单项; |
样式一(带文字) 样式二(不带文字) |
![]() |
1.Supcan Report允许自定义的工具条;
<script>insertReport('AF1', 'UserRebar=reportdata/toolbarpack.zip; Rebar=MyToolbar')</script>
自定义工具条的关键就是相对URL reportdata/toolbarpack.zip 包,请打开它,或查看相关开发文档.2.页面中响应外部功能的js如下:
function OnEvent(id, Event, p1, p2, p3, p4)
{
if(Event == "Toolbar" ) {
var af = document.getElementById(id);
if(p1>=3000) af.func("MessageBoxFloat", "自定义工具条触发了js事件!\\r\\n\\r\\n功能号:" + p1);
}
else if(Event == "MenuClicked" ) {
var af = document.getElementById(id);
af.func("MessageBoxFloat", "自定义菜单触发了js事件!\\r\\n\\r\\n功能号:" + p1);
}
else if(Event == "MenuBeforePopup") {
var af = document.getElementById(id);
var hLock = af.func("EventLock", Event); //仅用于Chrome ppapi:必须尽快加锁
userDefineMenu(af);
af.func("EventUnLock", hLock); //仅用于Chrome ppapi:退出时解锁
}
}
3.自定义菜单的js函数 userDefineMenu(), 通过调用控件的API函数:AddMenu( ), 向菜单动态增加了2种语法菜单项,js如下:
function userDefineMenu(af) {
//使用 语法1 添加菜单项:
var menu="id=4001; text=男帽; icon=treelist/buttons.zip#301.ico; detail=夏季时装, 优惠直销, 尺寸齐全\r\n\
id=4002; text=时髦头巾; icon=treelist/buttons.zip#302.ico; detail=夏季时装, 优惠直销";
af.func("AddMenu", menu);
//使用 语法2 添加菜单项:
menu ='<?xml?><items>\
<item id="3104" text="滞销产品" icon="treelist/buttons.zip#304.ico">\
<item id="31041" text="库存1" icon="treelist/buttons.zip#304.ico" detail="中老年滞销衣帽, 折价处理"/>\
<item id="31042" text="库存2" icon="treelist/buttons.zip#305.ico" detail="20%折价处理"/>\
</item></items>';
af.func("AddMenu", menu);
}
4.还有另一种简易的自定义工具条方案: |
只要设定一下创建参数就行:
insertReport('AF3', 'TabScrollBar=none; ReBar=main; main=102,189,0,5001,5002; tip.5001=自定义功能1; tip.5002=自定义功能2; image.5001=report/icon1.bmp; image.5002=report/icon2.bmp')
|