I am using this filter function for my search bar. But it doesn't seems to be working.
The error that I am having is
Description Resource Path Location Type 1061: Call to a possibly undefined method refresh through a reference with static type spark.components:List. Malls.mxml /SGshopping/src/views line 15 Flex Problem
and
Description Resource Path Location Type 1119: Access of possibly undefined property filterFunction through a reference with static type spark.components:List. Malls.mxml /SGshopping/src/views line 14 Flex Problem
Sorry guys. I am still learning. This is really confusing and where did i do it wrongly?
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Malls"
creationComplete="malls.send()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:HTTPService id="malls" url="assets/employees.xml"
result="data=malls.lastResult.list.employee"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
private function filterDemo():void{
list.filterFunction=searchDemo; - I am having errors here
list.refresh(); - and here
}
private function searchDemo(item:Object):Boolean{
var isMatch:Boolean=false;
if(item.name.toLowerCase().search(search.text.toLowerCase())!=-1){
isMatch=true;
}
return isMatch;
}
]]>
</fx:Script>
<s:navigationContent/>
<s:titleContent>
<s:TextInput id="search" change="filterDemo()" x="10" y="10" prompt="Search"/>
</s:titleContent>
<s:List id="list" top="0" bottom="0" left="0" right="0"
dataProvider="{data}"
change="navigator.pushView(MallsDetails, list.selectedItem)">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer
label="{data.firstName} {data.lastName}"
messageField="title"/>
</fx:Component>
</s:itemRenderer>
</s:List>
</s:View>