Author: ilya_shaikovsky
Date: 2010-10-29 10:05:24 -0400 (Fri, 29 Oct 2010)
New Revision: 19769
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml
Log:
https://jira.jboss.org/browse/RF-9305
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml
===================================================================
---
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml 2010-10-29
13:25:04 UTC (rev 19768)
+++
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/clientFilter.xhtml 2010-10-29
14:05:24 UTC (rev 19769)
@@ -8,13 +8,14 @@
<p>Except the server-side <b>"autocomplete"</b> method which
could
be used to collect suggestion strings according to entered prefix,
<b>rich:autocomplete</b>
allows to define similar method for filtering at client side. It should
- be defined using <b>clientFilter</b> attribute which accepts custom
- filter function name. Function should accepts two parameters
<b>subString</b>
- and <b>value</b> and return boolean value which means if the value
- satisfies the substring passed. The function will be called for every
- available suggestion in order to construct new list of suggestions.</p>
- <p>This sample shows how to change the client filtering to
- <b>"contains"</b> instead of
<b>"startsWith"</b></p>
+ be defined using <b>clientFilterFunction</b> attribute which accepts
+ custom filter function name. Function should accepts two parameters
<b>subString</b>(current
+ input value considering tokens) and <b>value</b>(currently iterated
+ item value) and return boolean flag which means if the value satisfies
+ the substring passed. The function will be called for every available
+ suggestion in order to construct new list of suggestions.</p>
+ <p>This sample shows how to change the client filtering to
<b>"contains"</b>
+ instead of <b>"startsWith"</b></p>
<ui:include src="#{demoNavigator.sampleIncludeURI}" />
<ui:include src="/templates/includes/source-view.xhtml">
<ui:param name="src" value="#{demoNavigator.sampleIncludeURI}"
/>
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml
===================================================================
---
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml 2010-10-29
13:25:04 UTC (rev 19768)
+++
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/autocomplete/samples/clientFilter-sample.xhtml 2010-10-29
14:05:24 UTC (rev 19769)
@@ -5,9 +5,17 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
+ <script>
+ function customFilter(subString, value){
+ if(subString.length>=1) {
+ if(value.indexOf(subString)!=-1)
+ return true;
+ }else return false;
+ };
+ </script>
<h:form>
<rich:autocomplete mode="client" minChars="0"
autofill="false"
- clientFilter="if(subString.length>=1) if(value.indexOf(subString)!=-1) return
true;"
+ clientFilter="return customFilter(subString, value)"
autocompleteMethod="#{autocompleteBean.autocomplete}" />
</h:form>
</ui:composition>
\ No newline at end of file