//Allways set to null first!!!! else you get filter inside
the filter!
myArrayCollection.filterFunction=null;

Cato,

Can you give an example of this? I tried the following and

var foo:ArrayCollection  = new ArrayCollection([1,2,3,4]);
trace(foo);
foo.filterFunction = function(num:int):Boolean {
    return num % 2 == 1;
};
foo.refresh();
trace(foo);
foo.filterFunction = function(num:int):Boolean {
    return num % 2 == 0;
};
foo.refresh();
trace(foo);
foo.filterFunction = null;
foo.refresh();
trace(foo);

--- produces ---

1,2,3,4
(Array)#0
  [0] 1
  [1] 3
(Array)#0
  [0] 2
  [1] 4
1,2,3,4

I don't think ListCollectionView composes filterFunctions.

-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com

-----Original Message-----
From: Cato Paus <[EMAIL PROTECTED]>
Reply-To: flexcoders@yahoogroups.com
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Help: filterFunction and Dates
Date: Thu, 23 Oct 2008 17:02:27 -0000

Hi if you use java as backend do you serilaze the object ?

if so you can map the date objec to the date object in actionscript and
back..

here is a datefilter connetced to a arraycollection.

public function chkToDay():void
{
//Allways set to null first!!!! else you get filter inside
the filter!
myArrayCollection.filterFunction=null;
myArrayCollection.refresh();
myArrayCollection.filterFunction=toDayDateFilterFunc;
/* Refresh the collection view to apply the filter. */
myArrayCollection.refresh();
}

and the filter function

private function toDayDateFilterFunc(item:Object):Boolean
{
var toDay:Date = new Date();
//item.date is if you have a public var named date in your
DTO(Data Transfer Object)
return item.date== toDay;
}

Cato

--- In flexcoders@yahoogroups.com, "cox.blair" <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> With the help of another poster I was pointed in the correct direction
> to solve a problem I have:
>
> The two links were helpful:
>
>
http://livedocs.adobe.com/flex/3/html/help.html?content=controls_12.html
>
>
http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-items
\
-in-a-datagrid-in-flex/
>
> Based on the above information, I was able to accomplish all my tasks,
> except being able to sort dates.
>
> Problem #1 - How to format the date so that it displays as 2008-10-01.
> I have it all the way up to 2008-10-1. Apparently the 'day' is
> represented as a single digit. That won't work - using a MySQL db.
>
> Problem #2 - I am apparently lacking in my knowledge of ActionScript
> to correctly write the proper script to filter the date. What I can't
> seem to figure out is the correct syntax for working with dates, or
> perhaps simply a string or number containing "-" dashes?
>
> Sorry, I'm not providing code you to ponder over, I really only need a
> reference to start with so I can learn as I go. I've been searching
> but have not been able to locate a reference which deals with sorting
> dates?
>
> Thanks,
>




 


Reply via email to