hi guy i appreciate that you are really trying to help. but so far i
still have the same problem, when i remove the slider from the filter
equation the datagrid is filtered but when i add it something wired
happens(the data disappears from the grid) here is a sample of my code
and i call the filterGrid() function on the change event of the two
combos and the slider, is that the correct way of doing it? hope this
will help solve my problem. thanks

<mx:RemoteObject id="homeSvc" destination="ColdFusion"
source="iestate.cfcs.homes1" showBusyCursor="true"
fault="CursorManager.removeBusyCursor();Alert.show(event.fault.message)">
                <mx:method name="load" result="displayResult(event)" /> 
                <!--<mx:method name="getCountries" 
result="countryResult(event)"/>-->
                <mx:method name="getcities" result="cityResult(event)" />
                <mx:method name="getlocation" result="locationResult(event)" /> 
        
        </mx:RemoteObject>

<mx:ComboBox x="0" y="52" width="182" id="city_cb"
labelField="city_name" change="filterGrid();" selectedIndex="0"/>
<mx:ComboBox x="0" y="108" width="182" id="lct_cb"
labelField="lct_name" change="filterGrid()" selectedIndex="0"/>
<mx:HSlider x="0" y="240" id="priceSlider" minimum="0"
maximum="3000000" allowThumbOverlap="false" tickInterval="100000"
snapInterval="10" thumbCount="2" values="[0,3000000]"
tickColor="#ffffff" labels="[$0k,$3000000M]" liveDragging="true"
width="182" change="filterGrid()"/>
<mx:DataGrid width="50%" height="100%" id="dgrid"
dataProvider="{dataAr}" rowCount="20" change="animateMapOut();">
                                                <mx:columns>
                                                        <mx:DataGridColumn 
headerText="Price" dataField="price"/>
                                                        <mx:DataGridColumn 
headerText="BedRooms" dataField="bedrooms"/>
                                                        <mx:DataGridColumn 
headerText="BathRooms" dataField="bathrooms"/>
                                                        <!--<mx:DataGridColumn 
headerText="Stories" dataField="col4"/>-->
                                                </mx:columns>
                                        </mx:DataGrid>



/////////////data
functions/////////////////////////////////////////////////////////////////
            public function InitCountry():void{
                homeSvc.getCountries();
            }
            public function countryResult(event:ResultEvent):void{
                                ctry_cb.dataProvider = event.result;
                        }                       
                        
                private var cityAr:ArrayCollection ;          
                        public function cityResult(event:ResultEvent):void{     
                        
                                cityAr = event.result as ArrayCollection;       
 
                        //add an Object at the beginning of the areaAryCol
                        var city:Object = {city_id: -1, city_name: "All"};
                        cityAr.addItemAt(city, 0);        
                        //reset the areaCB's data provider to so the above 
                        //Object is display at the top of the combo box
                        city_cb.dataProvider = cityAr ;
                        cityAr.refresh();
                        city_cb.selectedIndex = 0
                        }
                        
                        private var lctAr:ArrayCollection ;          
                        public function locationResult(event:ResultEvent):void{ 
                        
                                lctAr = event.result as ArrayCollection;        
                        //add an Object at the beginning of the areaAryCol
                        var location:Object = {lct_id: -1, lct_name: "All"};
                        lctAr.addItemAt(location, 0);        
                        //reset the areaCB's data provider to so the above 
                        //Object is display at the top of the combo box
                        lct_cb.dataProvider = lctAr ;
                        lct_cb.selectedIndex = 0;
                        }                       
                        
           [Bindable]
           private var dataAr:ArrayCollection = new ArrayCollection;
            public function displayResult(event:ResultEvent):void{
                                dataAr = new ArrayCollection( (event.result as
ArrayCollection).source);                               
                        }
                        
                
////////////////////////filters//////////////////////////////////////////////////////////////////////////
                        
                         public function filterGrid():void{
                         dataAr.filterFunction=cityFilter;
                         dataAr.refresh();
                         //dgrid.selectedIndex = null;          
                         }
                         
                         public function cityFilter(item:Object):Boolean{
                         var result:Boolean=false;

                 if ( (city_cb.selectedLabel == "All" || item.city ==
city_cb.selectedLabel) && (lct_cb.selectedLabel == "All" ||
item.location == lct_cb.selectedLabel)
                 ){
                 result=true; 
             } 
             return result;     
             } 

Reply via email to