工具栏基础配置
概述
根节点
参数
根节点
示例
SysButtons:用于配置网格系统按钮的样式以及按下该按钮时要执行的Script方法。 RuleName为空时,不控制权限直接显示,非空时,按权限设置显示
FormButtons:用于配置表单系统按钮的样式以及按下该按钮时要执行的Script方法。RuleName为空时,不控制权限直接显示,非空时,按权限设置显示
UserButtons:用于配置用户自定义的按钮的样式以及按下该按钮时要执行的Script方法。
默认显示:有Purview子节点时按指定权限控制权限
<ToolBar Name="SysUser">
<SysButtons>
<Button RuleName="Append" Name="cmd新建" Text="新建" ToolTip="新建" Type="Normal" Image="WebToolBar/16_create.gif" DisplayMode="TextAndImage" OpenType="open" WinPageURL="Config/SingleForm.aspx" WinWidth="100px" WinHeight="200px" Script="__WebGridAppend()"></Button>
<Button RuleName="Delete" Name="cmd删除" Text="删除" ToolTip="删除" Type="Normal" Image="WebToolBar/16_Delete.gif" DisplayMode="TextAndImage" Script="__WebGridDelete(1)"></Button>
</SysButtons>
<FormButtons>
<Button RuleName="Modify" Name="cmd保存" Text="保存" ToolTip="保存" Type="Normal" Image="WebToolBar/16_Save.gif" DisplayMode="TextAndImage" Script="__WebFormSave()" Target="Form" Mode="TextAndImage"></Button>
<Button RuleName="Modify" Name="cmd保存并新建" Text="保存并新建" ToolTip="保存并新建" Type="Normal" Image="WebToolBar/16_saveNew.gif" DisplayMode="TextAndImage" Script="__SaveFormAndOpenNew()"></Button>
<Button RuleName="Modify" Name="cmd保存并关闭" Text="保存并关闭" ToolTip="保存并关闭" Type="Normal" Image="WebToolBar/16_saveClose.gif" DisplayMode="TextAndImage" Script="__SaveFormAndClose()"></Button>
<Button RuleName="Remark" Name="cmd关闭" Text="关闭" ToolTip="关闭" Type="Normal" Image="WebToolBar/16_close.gif" DisplayMode="TextAndImage" Script="__FormClose()"></Button>
</FormButtons>
<UserButtons>
<Button Target="Grid" Name="cmd修改用户角色" Text="修改用户角色" ToolTip="修改用户角色" Type="Normal" Image="WebToolBar/16_customer.gif" DisplayMode="TextAndImage" Script="modifyRole()">
<Purview Id="00000000-0000-0000-0000-000000000000" Name="角色1" Type="Role">
<Deny Id="00000000-0000-0000-0000-000000000002" Name="用户2" Type="User"></Deny>
</Purview>
<Purview Id="00000000-0000-0000-0000-000000000002" Name="角色2" Type="Role">
</Purview>
</Button>
<Button Target="Grid" Name="cmd用户部门设置" Text="用户部门设置" ToolTip="用户部门设置" Type="Normal" Image="WebToolBar/16_Setting.gif" DisplayMode="TextAndImage" Script="unitConfig()">
</Button>
</UserButtons>
<Scripts>
<Script Type="Grid" Text="脚本块" >
<![CDATA[
]]>
</Script>
</Scripts>
</ToolBar>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Align
概述
工具栏属性Align:对齐方式值:right,center,left(默认)。
示例
<ToolBar UniqueNo="0" align="left">
IsButton
概述
工具栏属性IsButton:是否以按钮形式呈现值:true,false(默认)。
示例
<ToolBar UniqueNo="0" align="left" IsButton="false">
工具栏基本参数
概述
SysButtons:用于配置系统按钮的样式以及按下该按钮时要执行的Script方法。
FormButtons:用于配置用户自定义的按钮的样式以及按下该按钮时要执行的Script方法。
UserButtons:用于配置用户自定义的表单按钮的样式以及按下该按钮时要执行的Script方法。
RightMenus:右键菜单
参数
Button
Menu
示例
SysButtons:用于配置系统按钮的样式以及按下该按钮时要执行的Script方法。
FormButtons:用于配置用户自定义的按钮的样式以及按下该按钮时要执行的Script方法。
UserButtons:用于配置用户自定义的表单按钮的样式以及按下该按钮时要执行的Script方法。
RightMenus:右键菜单
<ToolBar align="left" IsButton="false">
<SysButtons>
</SysButtons>
<FormButtons>
</FormButtons>
<UserButtons>
</UserButtons>
<RightMenus>
<Menu>
</Menu>
</RightMenus>
</ToolBar>
2
3
4
5
6
7
8
9
10
11
12
FormButtons
概述
FormButtons:表单系统按钮
参数
Button
SysButtons
概述
SysButtons网格系统按钮
参数
Button
UserButtons
概述
UserButtons用户自定义按钮
参数
Button
RightMenus
概述
RightMenus右键菜单
参数
Menu
Menu
概述
Menu
相关属性:Name,Text,Image,Action
参数
Menu
示例
<RightMenus>
<Menu Name="标识" Text="显示文本" Image="WebToolBar/16_Setting.gif" Action="js代码">
<Menu Name="标识1" Text="子菜单显示文本1" Image="WebToolBar/16_Setting.gif" Action="js代码"/>
<Menu Name="标识2" Text="子菜单显示文本2" Image="WebToolBar/16_Setting.gif" Action="js代码"/>
</Menu>
</RightMenus>
2
3
4
5
6
工具栏事件方法
概述
根节点
参数
根节点
示例
相关方法
/*********工具栏相关方法及事件****************/
////工具栏方法
//取得工具栏对象
var toolBarObj = wm.c.getToolBar();
//取得列对象
var name="";
var item = toolBarObj.getNamedItem(name); //toolbarObj.getItemByName(name);
//取得html对象
var obj = item.HtmlObj;
//禁用
var state = true;
////xml对象
// <xml id="U_toolxml001">
// <!--[CDATA[
// <ToolBar Align="left" IsButton="False">
// <Cmd Name="cmdNew" Text="新建" DisplayMode="TextAndImage" Type="Button" Image="WebToolBar/16_create.gif" Action="_Create()" IsReadOnly="False" Tooltip="新建" ></Cmd>
// <Cmd Name="cmdOpen" Text="打开" DisplayMode="TextAndImage" Type="Button" Image="WebToolBar/16_create.gif" Action="_Open()" IsReadOnly="False" Tooltip="打开" ></Cmd>
// <Cmd Name="cmdSave" Text="保存" DisplayMode="TextAndImage" Type="Button" Image="WebToolBar/16_save.gif" Action="_Save()" IsReadOnly="False" Tooltip="保存" ></Cmd>
// <Cmd Name="cmdSaveAs" Text="另存为" DisplayMode="TextAndImage" Type="Button" Image="WebToolBar/16_save.gif" Action="_SaveAs()" IsReadOnly="False" Tooltip="另存为" ></Cmd>
// <Cmd Name="cmd删除" Text="删除" DisplayMode="TextAndImage" Type="Button" Image="WebToolBar/16_Delete.gif" Action="_Delete()" IsReadOnly="False" Tooltip="删除" ></Cmd>
// <Cmd Name="cmd分隔符" Text="分隔符" DisplayMode="TextAndImage" Type="Separator" Image="WebToolBar/Separator.gif" Action="" IsReadOnly="False" Tooltip="分隔符" ></Cmd>
// </ToolBar>
// ]]-->
// </xml>
//生成工具栏对象
var __toolBarId = "U_toolbar001";
var xml = wm.str.resetHCDATA(document.getElementById("U_toolxml001").innerHTML);
window[__toolBarId] = new WebToolBar(document.getElementById("ToolBarContainer"), xml);
/* 加载XML数据,并转换成指定格式的JSON数据*/
toolBarObj.loadXML(xml);
// 生成工具栏 按钮项
toolBarObj.renderItem(btn);
/* 解析按钮节点数据*/
//currentArray:新增节点按钮的插入位置,cmdNode:新增的节点按钮
toolBarObj._parseCommand(currentArray, cmdNode);
//窗体大小改变
toolBarObj.onResize();
//根据按钮名称获得工具栏对应的按钮对象
toolBarObj.getItemByName(bottonName);
//根据按钮对象 启用或者禁用,灰色不可操作
toolBarObj.setBtnDisabled(btn, state);
//根据按钮名称 启用或者禁用 按钮操作
toolBarObj.setBtnDisabledByName(btnName, state);
//显示工具栏
toolBarObj.showButtons();
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97