Hmm, it doesn¹t actually work. Though I need to try Cato¹s example. See I discovered this earlier this morning, the .selectedDate actually outputs - Wed Oct 1 00:00:00 GMT-0300 2008, while I would require 2008-10-01. As I mentioned, I had it down to 2008-10-1, but choose to manually enter the variable until I had one part functioning and would come back to the datefield selection.
Below is my very hacked sample code I¹m testing with. Please excuse the mess, but I figured I would provide what I was working with in case I¹ve missed something. Thanks. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:DateFormatter id="dfconv" formatString="YYYY-MM-DD"/> <mx:RemoteObject id="myservice" source="WorkingDemo" destination="amfphp" fault="faultHandler(event)" showBusyCursor="true"> <mx:method name="getUsers" result="resultHandler(event)" fault="faultHandler(event)"> </mx:method> </mx:RemoteObject> <mx:Script> <![CDATA[ import amf.amfLink; import mx.utils.ArrayUtil; import mx.collections.ArrayCollection; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.controls.Alert; import mx.events.CalendarLayoutChangeEvent; [Bindable] private var dp:ArrayCollection; private function faultHandler(event:FaultEvent):void { Alert.show(event.fault.faultString, event.fault.faultCode.toString()); } private function resultHandler(event:ResultEvent):void { dp=new ArrayCollection(ArrayUtil.toArray(event.result)); } private function toggleFilter():void { if (checkBox.selected) { dp.filterFunction = processFilter; } else { dp.filterFunction = null; } dp.refresh(); } //private function processFilter(item:Object):Boolean { // return (item.Date_Collected) == Number(wholeDate.text); //} private function processFilter(item:Object):Boolean { return (item.Date_Collected) == wholeDate.selectedDate; } //private function processFilter(item:Object):Boolean { // var wholeDate:Date = new Date(); //item.date is if you have a public var named date in your DTO(Data Transfer Object) // return item.Date_Collected == wholeDate; //} [Bindable] public var yAxis:ArrayCollection = new ArrayCollection( [ {label:"UC1"}, {label:"QGA_VF"}, {label:"QGA_VuB"}, {label:"QGA_RLU"}, {label:"QGA_ATP"}, {label:"QGA_Micro_Equiv"},]); //private function useDate(eventObj:CalendarLayoutChangeEvent):void { // Make sure selectedDate is not null. //if (eventObj.currentTarget.selectedDate == null) { // return //} //Access the Date object from the event object. //day.text=eventObj.currentTarget.selectedDate.getDay(); //date.text=eventObj.currentTarget.selectedDate.getDate(); //month.text=eventObj.currentTarget.selectedDate.getMonth() + 1; //year.text=eventObj.currentTarget.selectedDate.getFullYear(); //wholeDate.text= (eventObj.currentTarget.selectedDate.getMonth() + 1) + // "-" + (eventObj.currentTarget.selectedDate.getDate() + // "-" + eventObj.currentTarget.selectedDate.getFullYear()); //wholeDate.text= (eventObj.currentTarget.selectedDate.getFullYear() + // "-" + (eventObj.currentTarget.selectedDate.getMonth() + 1) + // "-" + eventObj.currentTarget.selectedDate.getDate()); private function formatDate(date:Date):String { return dfconv.format(date); } //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; //} ]]> </mx:Script> <mx:Canvas width="100%" height="198"> <mx:Button x="10" y="10" label="Get data" click="myservice.getOperation('getUsers').send()"/> <mx:DataGrid x="10" y="40" width="100%" height="137" dataProvider="{dp}"> <mx:columns> <mx:DataGridColumn headerText="Sample_Point" dataField="Sample_Point"/> <mx:DataGridColumn headerText="Date_Collected" dataField="Date_Collected"/> <mx:DataGridColumn headerText="Time_Collected" dataField="Time_Collected"/> <mx:DataGridColumn headerText="Date_Tested" dataField="Date_Tested"/> <mx:DataGridColumn headerText="Time_Tested" dataField="Time_Tested"/> <mx:DataGridColumn headerText="Analyst" dataField="Analyst"/> <mx:DataGridColumn headerText="Luminometer" dataField="Luminometer"/> <mx:DataGridColumn headerText="UC1" dataField="UC1"/> <mx:DataGridColumn headerText="ALB_RLU" dataField="ALB_RLU"/> <mx:DataGridColumn headerText="ALB_ATP" dataField="ALB_ATP"/> </mx:columns> </mx:DataGrid> </mx:Canvas> <mx:Canvas width="974" height="463"> <mx:LineChart id="linechart1" dataProvider="{dp}" x="550" y="10"> <mx:series> <mx:LineSeries id="Series1" form="curve" displayName="Series 1" itemRenderer="mx.charts.renderers.CircleItemRenderer" yField="{SelectyAxis1.selectedItem.label}" > <mx:verticalAxis> <mx:LinearAxis id="v1" baseAtZero="false" /> </mx:verticalAxis> </mx:LineSeries> </mx:series> </mx:LineChart> <mx:Legend dataProvider="{linechart1}" x="28" y="357"/> <mx:Text x="10" text="1." y="14" width="23"/> <mx:CheckBox x="261" y="10" id="checkBox" click="toggleFilter();"/> <mx:ComboBox id="SelectyAxis1" x="41" y="10" width="210" dataProvider="{yAxis}" selectedIndex="-1" prompt="Click to Select..." enabled="true" fontFamily="Arial" fontWeight="normal" fontSize="10"> </mx:ComboBox> <mx:TextInput x="292" y="8"/> <mx:DateField x="292" y="41" width="160" id="wholeDate" editable="true" showToday="true" labelFunction="formatDate" parseFunction="null"/> <mx:Text x="292" y="126" text="{wholeDate.selectedDate}"/> </mx:Canvas> </mx:Application> -- Blair From: Cato Paus <[EMAIL PROTECTED]> Reply-To: <[email protected]> Date: Thu, 23 Oct 2008 18:49:10 -0000 To: <[email protected]> Subject: [flexcoders] Re: Help: filterFunction and Dates 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] <mailto:flexcoders%40yahoogroups.com> , "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

