This version has radio buttons to search first or last names, onFocus of TextInput box text is cleared. source | v2 | v1
This entry was posted
on Wednesday, August 1st, 2007 at 12:55 am and is filed under ArrayCollection, DataGrid, Flex.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Thank you for this helpful filtering example. The flexbuilder site provided the one with .refresh() function, which didn`t worked for me when used with ArrayCollection. This approach with detached search() and filter assign function works fine.
hye…i have implemented your code above into my codes.i have encounter some problem.could you help me??i have been correcting and getting error for 2 weeks!!wish you can help me..thanks a lot.
-1)
{
if (!dp) dp = XMLList(sourceArray[lt]);
else dp += XML(sourceArray[lt]);
}
}
}
private function checkbox_clickHandler(event:MouseEvent):void
{
var requestTypes:Array = [];
for each(var cb:CheckBox in checkboxesArray)
{
if (cb.selected)
{
switch (cb)
{
case checkboxesArray[0]:
requestTypes.push(LogReader.DYNAMIC);
break;
case checkboxesArray[1]:
requestTypes.push(LogReader.STATIC);
break;
case checkboxesArray[2]:
requestTypes.push(LogReader.IMAGE);
break;
case checkboxesArray[3]:
requestTypes.push(LogReader.UNDEFINED);
break;
default:
trace("Checking log files");
break;
}
}
}
if (requestTypes.length)
{
filterOnUrlType(requestTypes);
} else {
dp = XMLList(sourceArray.join(""));
}
}
public function filter():void
{
dp.filterFunction = filterUrl;
}
public function filterReset():void
{
dp.filterFunction = null;
}
private function filterUrl(item:Object):Boolean
{
return item [selectedLog].match(new RegExp(searchField.text, 'i'))
}
private function search():void
{
if(searchField.text !='')
{
filter()
}
else
{
filterReset()
}
}
private function handleCard(event:ItemClickEvent):void
{
selectedLog = event.currentTarget.selectedValue as String;
}
private function eraseText(event:MouseEvent):void
{
searchField.text = '';
}
]]>
seems like the code doesn’t appear fully.
the code needs a creationComplete=”init()” in the Application tag. My bad