6 Replies Latest reply on Sep 29, 2009 9:24 AM by nikos101

    Filter function causing 0 items in combo box

    nikos101 Level 2

      HI there, I have combobox with the dataProvider set up like below

          <mx:ComboBox rowCount="10" id="selectUser" 
                          dataProvider="{VO.getInstance().clientsResultForAddTrade}" width="258"
                          x="28" y="10" >        


                      </mx:ComboBox>

       

      in the VO class I have some code that calls the filter function (when clientsResultForAddTrade is refreshed in the clientsDataChangeHandler) when the clientsResultForAddTrade data changes.

       

       

       

       

            private function clientsDataChangeHandler( event:PropertyChangeEvent ):void{
                 clientsResultForAddTrade.refresh();
            }  
                     

              public function VO(caller:Function=null)
              {
                  if (caller != VO.getInstance)
                  {
                      throw new Error("Singleton is a singleton class, use getInstance() instead");
                  }
                  if (VO.instance != null)
                  {
                      throw new Error("Only one Singleton instance should be instantiated");
                  }
                  //put instantiation code here
                 
                  clientsResultForAddTrade.filterFunction = clientAuthorisedFilterFunction;
                   activityWatcher = ChangeWatcher.watch( this, "clientsResultForAddTrade", clientsDataChangeHandler);


              }
             
                  private function clientAuthorisedFilterFunction(item:Object):Boolean
                  {
                      var b:Boolean =  item.status == 'Authorised';
                      return item.status == 'Authorised';
                  }

       

       

      However there are 0 items in the selectUser combobox after the filter function is called, I have checked that it returns true when item.status == 'Authorised'

       

      Please advise, 10 points available