Hello Guys, i have used multiple filter functions before but i have never used one that involves a date range. I have an arraycollection with items (title, entity and signature_date). i would like to filter the results of the array collection based on those 3 fields of data.
i want to have it in such a way that signature_date is filtered based on date range, so on my UI i have a text input (id= titleSearch), combobox(entitySearch) and 2 data fields (sDate and eDate). I can do a filter based on the text input and combobox, but i don't know how to apply the date fields in the filter function. Can some please help guide me on this. Below is sample code /************* start filtering ***********************/ private var docTitle:String="title"; private var selectedEntity:String="--- SELECT ENTITY ---"; private function filterGrid():void { collectionAr.filterFunction=myFilterFunction; collectionAr.refresh(); } private function myFilterFunction(item:Object):Boolean { return (item[docTitle].match(new RegExp(titleSearch.text, 'i'))) && (item.entity == selectedEntity || selectedEntity == "--- SELECT ENTITY ---"); } private function titleChangeHandler(event:Event):void { if (titleSearch.text != '') { filterGrid(); } else { filterReset() } docs.selectedIndex=0; } private function entityChangeHandler(event:Event):void { if (entitySearch.selectedItem != null) selectedEntity=entitySearch.selectedLabel; filterGrid(); docs.selectedIndex=0; } private function filterReset():void { collectionAr.filterFunction=null; collectionAr.refresh(); }