zoukankan      html  css  js  c++  java
  • Flex ArrayCollection过滤数据filterFunction

    查询数据库并把数据ArrayCollection绑定到控件后,

    如果需要执行频率不小的检索(认为是不需要频繁请求数据库)

    则可以使用对数据源(类型为ArrayCollection)的filterFunction设置过滤函数

    filterFunction(item:Object):Boolean 用于消除不符合条件的项item

    <s:TextInput change="filterAC()" id="txtIn">

    private function filterAC():void
    {
         if(txtIn.text!="")
        {
            _npcM.NpcList.filterFunction=filteDataByInput;
            _npcM.NpcList.refresh();
        }else{

            //检索输入为空时:恢复所有数据
            _npcM.NpcList.filterFunction=null;
            _npcM.NpcList.refresh();
        }
    }
    //具体的过滤函数:返回值boolean 接受参数item datagrid的一行记录

    private function filteDataByInput(item:Object):Boolean
    {
        var result:Boolean=false;//返回值
         if(drpl.selectedIndex==0)
         {
          //名称
              if(String(item["f_name"]).indexOf(txtIn.text)>=0)
             {
                 result=true
              }
          }
         return result;
    }

  • 相关阅读:
    笨办法42物以类聚(补充40)
    笨办法41来自 Percal 25 号行星的哥顿人-randint-exit(0)
    nginx模块1--索引autoindex_基于ip_监控模块status
    selinux
    nginx安装与配置--基础
    svn安装
    docker-registry私有registry
    zabbix钉钉报警
    zabbix字体
    zabbix告警
  • 原文地址:https://www.cnblogs.com/naiking/p/2605469.html
Copyright © 2011-2022 走看看