- 浏览: 584191 次
文章分类
- 全部博客 (174)
- Core Java 学习 (6)
- Hibernate 学习 (3)
- Struts 学习 (3)
- Spring 学习 (9)
- EJB 学习 (0)
- 设计模式 (0)
- Oracle 学习 (6)
- JRuby (0)
- PHP (18)
- MySql (7)
- Apache (6)
- Informix (2)
- JSTL (1)
- CSS+HTML (8)
- Ajax (2)
- javaScript (16)
- reverse Ajax (1)
- Discuz (7)
- 网站 (11)
- SEO (5)
- Linux (4)
- ecshop (1)
- 电子商务 (1)
- 文档在线浏览 (18)
- 服务器技术 (10)
- flex (17)
- 用户体验 (1)
- java (1)
- flex+blazeDS (1)
- tomcat (1)
- 开发管理 (1)
最新评论
-
niaoqq1:
真坑爹,全是中文字符,复制全部报错!
<c:forEach 详解 -
jhys7s8jd:
pdf打印机下载http://www.onlinedown.n ...
命令行下转换word文档成PDF -
海豚12315:
flashPaper读取磁盘上的文件路径,
最好是放到某个系统 ...
在线文档阅读实现的解决方案 -
八月约克:
火狐不支持这个东东
Scripting.Dictionary的使用 -
longgol:
有一问:怎么通过flashPaper读取磁盘上的文件路径呢。我 ...
在线文档阅读实现的解决方案
Flex中的 Tree 是很难被过滤的,因为它们包含继承的关系。一个可行的方法是使用ArrayCollection作为dataProvider,而且这个ArrayCollection的每一个节点都有一个children属性,每个children也是ArrayCollection. 过滤Tree的一个棘手的问题是,必须确保从子节点到跟节点都被过滤。所以,在下面的例子中,我写了一个function,它将循环每一个节点及其所有的子节点。 过滤的发生是自上而下的,这就意味着一个节点的所有的子节点总是在它自身之前被过滤。这一点很重要,因为通常过滤器将删除所有不匹配某一标准的所有东西。<?xml version="1.0" encoding="utf-8"?>
<!--http://yecon.blog.hexun.com/30299161_d.html -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import vo.Person;
import mx.collections.ArrayCollection;
[Bindable]
private var people:ArrayCollection = new ArrayCollection([
new Person("Grandma Susan", new ArrayCollection([
new Person("John", new ArrayCollection([
new Person("Timmy"),
new Person("Sammy"),
new Person("Alan")
])),
new Person("Tiffany", new ArrayCollection([
new Person("Billy"),
new Person("Adam"),
new Person("Graham"),
new Person("Vennesa")
])),
new Person("Michael", new ArrayCollection([
new Person("Jannette"),
new Person("Alan", new ArrayCollection([
new Person("Alice"),
new Person("Jane")
]))
])),
new Person("Peter"),
new Person("Cindy", new ArrayCollection([
new Person("Paul"),
new Person("David"),
new Person("Joseph"),
new Person("Cameron"),
new Person("Debra"),
new Person("Polly")
]))
]))
]);
private function refreshData():void{
//reset the root node to its original unfiltered data
people[0].children = new ArrayCollection(people[0].children.source);
//start the recursion at the root node
refreshRecursiveChildren(people.source[0]);
//update the Tree after the data has been filtered
personsTree.invalidateList();
}//end refreshData function
private function refreshRecursiveChildren(person:Person):void{
if(person.children){
//loop through each child and filter its children
for each(var _person:Person in person.children.source){
refreshRecursiveChildren(_person);
}
//reset each "children" ArrayCollection to its original unfiltered data
person.children = new ArrayCollection(person.children.source);
//set the filterfunction for the newly updated node
person.children.filterFunction = filterData;
//run the fitlerFunction
person.children.refresh();
}
}//end refreshRecursiveChildren function
public function filterData(item:Object):Boolean{
//get the string to filter the nodes by
var searchString:String = iNameFilter.text;
//if string is found in node return true.
//since the recursive filtering takes place from bottom up, if
//a collection still has children after filtering, also return true
if(searchString.length == 0 || item.name.toLowerCase().indexOf(searchString.toLowerCase()) >= 0)
return true;
else if(item.children != null && item.children.length > 0)
return true;
return false;
}//end filterData function
]]>
</mx:Script>
<mx:VBox width="100%" height="100%" paddingTop="10" paddingBottom="10" paddingLeft="5" paddingRight="5">
<mx:Tree id="personsTree" dataProvider="{people}" labelField="name" width="100%" height="100%" />
<mx:HBox>
<mx:Label text="Filter the Tree:" />
<mx:TextInput id="iNameFilter" change="refreshData()" />
</mx:HBox>
</mx:VBox>
</mx:Application>//vo.Person.as
package vo{
//http://yecon.blog.hexun.com/30299161_d.html
import mx.collections.ArrayCollection;
public class Person{
public var name:String;
public var children:ArrayCollection;
public function Person(_name:String, _children:ArrayCollection = null){
this.name = _name;
if(_children != null)
this.children = _children;
}//end Person constructor
}//end Person class
}//end package declaration
发表评论
-
图片遮罩
2011-11-25 18:03 1132<mx:Canvas width="10 ... -
datagrid中滚动条问题
2011-11-14 18:26 3623经常有人在看了前面写的《Flex实现多文 ... -
flex 弹出菜单
2011-11-04 14:38 1195<?xml version="1.0" ... -
AIR管理文件关联, 指定文件默认打开方式
2011-10-30 17:50 2261参考:http://help.adobe.com/zh_CN/ ... -
如何区分不同的订阅者。以便实现个性化订阅。
2011-10-28 04:12 1568参考文章 http://hi.baidu.com/wos ... -
在messaging服务中的服务端的一些属性的说明
2011-10-27 03:29 1074Subscription-timeout-minutes:在这 ... -
Flex事件冒泡机制
2011-09-28 23:22 2730在网上浏览了几篇文章,大体总结了一下,简单说明如下: 事 ... -
Adobe Flex迷你教程 -- 合理使用Module分割项目以及对Module的使用
2011-09-26 15:27 1026现在说说Module,这篇教程代码不是最重要的,怎么样合理的使 ... -
12条有用的Flex代码
2011-09-19 21:46 10201.复制内容到系统剪贴板 System.setClipbo ... -
Flex中的 for in 与 for each in
2011-09-12 19:07 1154for...in循环中的迭代变量是对象中的键名(Flex中 ... -
Flex AIR)创建“不规则形状”的Air透明窗体(二)--使用Flex SDK4.5.1
2011-09-10 15:53 2414在此之前,我曾写过一篇关于《创建“不规则形状”的Air透明 ... -
Flex Application 初始化顺序
2011-09-08 16:12 1436Flex应用程序共由两帧组成,第1帧为preloader部分, ... -
Adobe Flash Builder的强大功能--移动设备控制桌面Apps
2011-09-08 14:29 932这个视频中,Adobe平台技术经理Tomas Krcha将会给 ... -
利用AIR的ServerSocket类让 AIR 做socket服务器
2011-08-30 16:13 5831新的air sdk 新增了 ServerSocket类, ... -
Fms3和Flex打造在线多人视频会议和视频聊天(附原代码)<视频聊天,会议开发实例3>
2011-08-27 14:06 1718本篇是视频聊天,会议 ... -
Adobe AIR中使用Flex连接Sqlite数据库(2)(添加,删除,修改以及语句参数)
2011-08-27 13:59 1065本章主要总结数据库的插入,删除,修改,以及语句参数的使用本 ...
相关推荐
NULL 博文链接:https://xaajie.iteye.com/blog/379054
NULL 博文链接:https://tangdonglai.iteye.com/blog/1478277
Flex的Array和ArrayCollection
tree多数情况下操作xml比较方便,而本人却对xml有些排斥,说得更确切些,对xml用的不是那么得心应手,所以选择了ArrayCollection
flex自定义用ArrayCollection做数据源的带checkbox的tree(功能强大的完美版^_^) .
原理就是ArrayCollection的filterFunction的使用。是根据老外一个帖子改的,其他下载地址在 :http://www.zuidaima.com/share/1714555305004032.htm
DataGrid条目过滤和Tree 所有节点过滤的例子 Flash Builder 4工程,可直接导入
ArrayCollection添加过滤器后,调用removeItemAt()是无法删除的,下面有个不错的解决方法,大家可以参考下
Flex 编程小技巧 1. 复制内容到剪贴板 1. System.setClipboard(strContent); 2. 复制一个 ArrayCollection 1. //dummy solution( well, it works ) 2. var bar:ArrayCollection = new ArrayCollection(); 3. for ...
Flex的ArrayCollection在某些情况无法绑定解决方法
//fr.data为flex加载excel的byte数组 var sheet:Array = excel.getSheetArray();//得到表格数据,为Array格式 var datasource:ArrayCollection = new ArrayCollection(sheet); //可转换为ArrayCollection,用于表格...
ArrayCollection求最大值,最小值,排序。供大家共同学习一下。
首先环境:Myeclipse+Flex4.5+FusionCharts 至于FusionCharts的相关文件稍后我将放在附件中。 1.新建flex工程: 2.对工程进行相应配置 3.继续配置: 4.找到fusioncharts文件中FusionChartsFlex\...
//fr.data为flex加载excel的byte数组 var sheet:Array = excel.getSheetArray();//得到表格数据,为Array格式 var datasource:ArrayCollection = new ArrayCollection(sheet); //可转换为ArrayCollection,用于...
如果你建立的项目不是flex项目,而需要使用ArrayCollection等,请把这个mx包引入解决问题
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" creationComplete="initTree();... // TODO: add some links here to Flex sites } ]]> </mx:Script> </mx:Application>
import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] private var slides:ArrayCollection private function resultHandler(event:ResultEvent):void ...
1. Java通过第三方控件POI操作Excel,读取的数据存储在...2. 通过Blazeds将ArrayList发送到Flex中的ArrayCollection中。(Blazeds构建过程不在本篇讨论范围,见flex4+blazeds+java通信(视频)) 3. 绑定到DataGrid。
flex通过httpService读取xml数据到datagird中,通过读取远程URL的XML数据(这里保存到本地),保存到ArrayCollection中,然后在将ArrayCollection绑定到datagird上 环境:flex3.0 可直接运行
java-flex-mysql,实现增删改查,用户富客户端Flex,后台java封装list形式,Flex前台ArrayCollection来接受!