it will work becouse the datefield returns a Date variable :) the formating is just for view it do't change the dateobject ;)
--- In [email protected], "Tim Hoff" <[EMAIL PROTECTED]> wrote: > > > Something like this: > > private function processFilter(item:Object):Boolean { > return (item.Date_Collected) == wholeDate.selectedDate; > } > > <mx:DateField id="wholeDate" formatString="YYYY-MM-DD"/> > > -TH > > --- In [email protected], "Tim Hoff" <TimHoff@> wrote: > > > > > > So, you're converting a String to a Number and comparing that to a > Date? > > Does that work? If not, perhaps using a DateField instead would work > > better; so that you'e comparing apples to apples. If it works though, > > nevermind. :) > > > > -TH > > > > --- In [email protected], Blair Cox blair.cox@ wrote: > > > > > > Hmm, okay, now I¹m confused. > > > > > > So this is the working end of my code, totally borrowed from > > > http://blog.flexexamples.com. > > > > > > private function processFilter(item:Object):Boolean { return > > > (item.Date_Collected) == Number(wholeDate.text); } > > > > > > ?? > > > > > > -- > > > Blair > > > > > > > > > > > > > > > > > > From: Tim Hoff TimHoff@ > > > Reply-To: [email protected] > > > Date: Thu, 23 Oct 2008 17:25:41 -0000 > > > To: [email protected] > > > Subject: [flexcoders] Re: Help: filterFunction and Dates > > > > > > > > > > > > > > > > > > Hey Blair, > > > > > > For dates, it's important that you use the Date() data type. Some > use > > > strings instead. Since you're using AMF, using strongly typed date > > > objects for the VO's is the cleanest way. The reason that I say to > use > > > Date(), is because that the Date.time property is stored as the > number > > > of milliseconds since 1970, IIRC. Because it' numeric, you can > easily > > > perform sorts. For formatting, you can use a dateFormatter with > > > "yyyy-mm-dd" as the formatString. This leaves the underlying date > > > alone, but displays it in whatever format that is specified. > > > > > > -TH > > > > > > --- In [email protected] > > <mailto:flexcoders%40yahoogroups.com> , > > > Blair Cox blair.cox@ wrote: > > > > > > > > Hi Cato, > > > > > > > > Thanks for the hint. I¹m using amfPHP and RemoteObject, I¹ll > > > assume it does > > > > the same thing. I¹ll use this as a starting point, cheers! > > > > > > > > -- > > > > Blair > > > > > > > > > > > > > > > > > > > > > > > > From: Cato Paus cato1@ > > > > Reply-To: [email protected] > > <mailto:flexcoders%40yahoogroups.com> > > > > Date: Thu, 23 Oct 2008 17:02:27 -0000 > > > > To: [email protected] > <mailto:flexcoders%40yahoogroups.com> > > > > Subject: [flexcoders] Re: Help: filterFunction and Dates > > > > > > > > > > > > > > > > > > > > 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 [email protected] > > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> , > > > > "cox.blair" blair.cox@ 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\ > \ > > \ > > > \ > > > > > > <http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-item\ > \ > > s> > > > > -in-a-datagrid-in-flex/ > > > > > > > > > > <http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-item\ > \ > > \ > > > s-in > > > > > > <http://blog.flexexamples.com/2008/03/12/using-a-combobox-to-filter-item\ > \ > > s-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, > > > > > > > > > > > > > > >

