和
请注意:行数是单选,所以数据源为:type="radio"。隐藏列为多选,为type="check"。(参考Menu的帮助文档)
数据源代码(Menu组件的规定格式就是这样的,如有疑问,请参考帮助文档Menu篇):
<mx:XML id="xmlDP">
<root>
<node label="行数" >
<node label='10' type="radio" groupName="radioGroup" toggled="true"/>
<node label='15' type="radio" groupName="radioGroup" />
<node label='30' type="radio" groupName="radioGroup"/>
<node label='50' type="radio" groupName="radioGroup"/>
</node>
<node label="隐藏列">
<node label="登录名称" type="check" value="1"/>
<node label="全名" type="check" value="2"/>
<node label="组织代号" type="check" value="3"/>
<node label="状态" type="check" value="4"/>
<node label="角色设置" type="check" value="5"/>
</node>
</root>
</mx:XML>
组件代码:
<mx:PopUpButton label="其它" id="pub" width="10%" creationComplete="creatMenu()"/>
AS代码:
//生成弹出菜单(隐藏列和显示条数)
private function creatMenu():void{
var menu:Menu = new Menu();
menu.labelField = "@label";
menu.dataProvider = xmlDP;
menu.showRoot = false;
menu.width = 100;
menu.addEventListener("itemClick",ick);//为itemClick添加监听函数(事件是这样引用的)
pub.popUp = menu;
}
//点击隐藏列和显示条数的menu时,响应函数
private function ick(evt:MenuEvent):void{
var str:String = evt.item.@label;
//页面大小改变事件
if(str.match(/^[0-9]+$/)){//使用正则表达式来判断此字符串是否包含数字
pageSize = int(str);//将str转换成int类型
this.height=setHeight(pageSize);
loadData(0);
}else{
var d:DataGridColumn = null;//声明一个DataGridColumn对象
switch(int(evt.item.@value)){//根据value属性判断属于哪个列
case 1:
d = logname; logname是列的ID
break;
case 2:
d = fullname;
break;
case 3:
d = orgid;
break;
case 4:
d = status;
break;
default:
d = role;
}
//设置隐藏或显示
if(d.visible == true){
d.visible = false;
} else{
d.visible = true;
}
}
- 大小: 5.8 KB
- 大小: 8.6 KB
分享到:
相关推荐
NULL 博文链接:https://tongqiuyan.iteye.com/blog/1207620
利用PopUpButton创建弹出下拉框的组件
PopupButton.zip,太多无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
自定义表格列头,利用PopupButton做的过滤界面,延伸可以利用PopupButton实现很多按钮弹出过滤界面的功能,内部有些代码可以删除
PopupCircleMenu 模仿花瓣的弹出式菜单 Gradle allprojects { repositories { maven { ...>新增: 支持设置Button的开关文字 对应Attribute pb...>PopupCircleView 里的第一个PopupButton作为中心按钮 可以不放图片
LinkButton | Menu | MenuBar | PopUpButton | PopUpMenuButton | ProgressBar | TabNavigator ToggleButtonBar | Tree | VScrollBar 为了方便使用,将Spark组件单独剥离出来,使用方案如下:(只限于spark组件) ...
选项菜单,PopupMenu,选中时,PopupButton,onSelected 列表中的下拉按钮,DropdownButton表单字段,DropdownButton FormField 警报对话 启用后退按钮 退出对话 应用栏 安全区 媒体查询 堆 溢出/剪辑行为 图像...
MumericStepper、PopUpButton、ProgressBar、RadioButton、RichTextEditor、Text、TextArea、TextInput TileList、Tree、VSlider VideoDisplay 7、容器控件(可包含控件及容器控件) Canvas、ControlBar、Form...