Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.util.Filter.html
1 <!DOCTYPE html><html><head><title>Ext.util.Filter | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
2 <style type="text/css">.head-band { display: none; }
3 .header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
4 .doc-tab .members .member a.more { background-color: #efefef; }
5 </style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
6 </head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
7 <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
8
9     req = {
10         liveURL: '.',
11         standAloneMode: true,
12         origDocClass: 'Ext.util.Filter',
13         docClass: 'Ext.util.Filter',
14         docReq: 'Ext.util.Filter',
15         version: '4.0',
16         baseURL: '.',
17         baseDocURL: '.',
18         baseProdURL: '.'
19     };
20
21     clsInfo = {};
22
23
24
25 </script>
26
27 <script type="text/javascript" src="../search.js"></script>
28 <!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
29 <script type="text/javascript" src="../class_tree.js"></script>
30 <script type="text/javascript" src="../class_doc.js"></script>
31 <script type="text/javascript">
32     req.source = 'Filter.html#Ext-util.Filter';
33     clsInfo = {"methods":["Filter"],"cfgs":["anyMatch","caseSensitive","exactMatch","filterFn","property","root"],"properties":[],"events":[],"subclasses":[]};
34     Ext.onReady(function() {
35         Ext.create('Docs.classPanel');
36     });
37 </script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Filter.html#Ext-util.Filter" target="_blank">Ext.util.Filter</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>Represents a filter that can be applied to a <a href="Ext.util.MixedCollection.html" rel="Ext.util.MixedCollection" class="docClass">MixedCollection</a>. Can either simply
38 filter on a property/value pair or pass in a filter function with custom logic. Filters are always used in the context
39 of MixedCollections, though <a href="Ext.data.Store.html" rel="Ext.data.Store" class="docClass">Store</a>s frequently create them when filtering and searching on their
40 records. Example usage:</p>
41
42
43 <pre class="prettyprint"><code>//set up a fictional MixedCollection containing a few people to filter on
44 var allNames = new Ext.util.MixedCollection();
45 allNames.addAll([
46     {id: 1, name: 'Ed',    age: 25},
47     {id: 2, name: 'Jamie', age: 37},
48     {id: 3, name: 'Abe',   age: 32},
49     {id: 4, name: 'Aaron', age: 26},
50     {id: 5, name: 'David', age: 32}
51 ]);
52
53 var ageFilter = new Ext.util.Filter({
54     property: 'age',
55     value   : 32
56 });
57
58 var longNameFilter = new Ext.util.Filter({
59     filterFn: function(item) {
60         return item.name.length > 4;
61     }
62 });
63
64 //a new MixedCollection with the 3 names longer than 4 characters
65 var longNames = allNames.filter(longNameFilter);
66
67 //a new MixedCollection with the 2 people of age 24:
68 var youngFolk = allNames.filter(ageFilter);
69 </code></pre>
70
71 <div class="members"><div class="m-cfgs"><div class="definedBy">Defined By</div><a name="configs"></a><h3 class="cfg p">Config Options</h3><h4 class="cfgGroup">Other Configs</h4><div id="config-anyMatch" class="member f ni"><a href="Ext.util.Filter.html#config-anyMatch" rel="config-anyMatch" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Filter.html" class="definedIn docClass">Ext.util.Filter</a><br/><a href="../source/Filter.html#Ext-util.Filter-cfg-anyMatch" class="viewSource">view source</a></div><a name="anyMatch"></a><a name="config-anyMatch"></a><a href="Ext.util.Filter.html#" rel="config-anyMatch" class="cls expand">anyMatch</a><span> : Boolean</span></div><div class="description"><div class="short"><p>True to allow any match - no regex start/end line anchors will be added. Defaults to false</p>
72 </div><div class="long"><p>True to allow any match - no regex start/end line anchors will be added. Defaults to false</p>
73 </div></div></div><div id="config-caseSensitive" class="member ni"><a href="Ext.util.Filter.html#config-caseSensitive" rel="config-caseSensitive" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Filter.html" class="definedIn docClass">Ext.util.Filter</a><br/><a href="../source/Filter.html#Ext-util.Filter-cfg-caseSensitive" class="viewSource">view source</a></div><a name="caseSensitive"></a><a name="config-caseSensitive"></a><a href="Ext.util.Filter.html#" rel="config-caseSensitive" class="cls expand">caseSensitive</a><span> : Boolean</span></div><div class="description"><div class="short"><p>True to make the regex case sensitive (adds 'i' switch to regex). Defaults to false.</p>
74 </div><div class="long"><p>True to make the regex case sensitive (adds 'i' switch to regex). Defaults to false.</p>
75 </div></div></div><div id="config-exactMatch" class="member ni"><a href="Ext.util.Filter.html#config-exactMatch" rel="config-exactMatch" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Filter.html" class="definedIn docClass">Ext.util.Filter</a><br/><a href="../source/Filter.html#Ext-util.Filter-cfg-exactMatch" class="viewSource">view source</a></div><a name="exactMatch"></a><a name="config-exactMatch"></a><a href="Ext.util.Filter.html#" rel="config-exactMatch" class="cls expand">exactMatch</a><span> : Boolean</span></div><div class="description"><div class="short"><p>True to force exact match (^ and $ characters added to the regex). Defaults to false.
76 Ignored if anyMatch is true.</p>
77 </div><div class="long"><p>True to force exact match (^ and $ characters added to the regex). Defaults to false.
78 Ignored if anyMatch is true.</p>
79 </div></div></div><div id="config-filterFn" class="member ni"><a href="Ext.util.Filter.html#config-filterFn" rel="config-filterFn" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Filter.html" class="definedIn docClass">Ext.util.Filter</a><br/><a href="../source/Filter.html#Ext-util.Filter-cfg-filterFn" class="viewSource">view source</a></div><a name="filterFn"></a><a name="config-filterFn"></a><a href="Ext.util.Filter.html#" rel="config-filterFn" class="cls expand">filterFn</a><span> : Function</span></div><div class="description"><div class="short">A custom filter function which is passed each item in the Ext.util.MixedCollection
80 in turn. Should return true to acc...</div><div class="long"><p>A custom filter function which is passed each item in the <a href="Ext.util.MixedCollection.html" rel="Ext.util.MixedCollection" class="docClass">Ext.util.MixedCollection</a>
81 in turn. Should return true to accept each item or false to reject it</p>
82 </div></div></div><div id="config-property" class="member ni"><a href="Ext.util.Filter.html#config-property" rel="config-property" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Filter.html" class="definedIn docClass">Ext.util.Filter</a><br/><a href="../source/Filter.html#Ext-util.Filter-cfg-property" class="viewSource">view source</a></div><a name="property"></a><a name="config-property"></a><a href="Ext.util.Filter.html#" rel="config-property" class="cls expand">property</a><span> : String</span></div><div class="description"><div class="short"><p>The property to filter on. Required unless a <a href="Ext.util.Filter.html#filter" rel="Ext.util.Filter#filter" class="docClass">filter</a> is passed</p>
83 </div><div class="long"><p>The property to filter on. Required unless a <a href="Ext.util.Filter.html#filter" rel="Ext.util.Filter#filter" class="docClass">filter</a> is passed</p>
84 </div></div></div><div id="config-root" class="member ni"><a href="Ext.util.Filter.html#config-root" rel="config-root" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Filter.html" class="definedIn docClass">Ext.util.Filter</a><br/><a href="../source/Filter.html#Ext-util.Filter-cfg-root" class="viewSource">view source</a></div><a name="root"></a><a name="config-root"></a><a href="Ext.util.Filter.html#" rel="config-root" class="cls expand">root</a><span> : String</span></div><div class="description"><div class="short">Optional root property. This is mostly useful when filtering a Store, in which case we set the
85 root to 'data' to make...</div><div class="long"><p>Optional root property. This is mostly useful when filtering a Store, in which case we set the
86 root to 'data' to make the filter pull the <a href="Ext.util.Filter.html#property" rel="Ext.util.Filter#property" class="docClass">property</a> out of the data object of each item</p>
87 </div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Filter" class="member f ni"><a href="Ext.util.Filter.html#method-Filter" rel="method-Filter" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Filter.html" class="definedIn docClass">Ext.util.Filter</a><br/><a href="../source/Filter.html#Ext-util.Filter-method-constructor" class="viewSource">view source</a></div><a name="Filter"></a><a name="method-Filter"></a><a href="Ext.util.Filter.html#" rel="method-Filter" class="cls expand">Filter</a>(
88 <span class="pre">Object config</span>)
89  : void</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
90 <h3 class="pa">Parameters</h3><ul><li><span class="pre">config</span> : Object<div class="sub-desc"><p>Config object</p>
91 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
92 </li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>