I am sorry but I am slow. By applying the filter in the main instance variable, 
are you suggesting that I put it somewhere within this function?
   
  private function accommodationLocatorResultHandler(event:ResultEvent):void
     {
            var lodgings:ArrayCollection = 
event.result.accommodations.accommodation;
           var temp:ArrayCollection = new ArrayCollection();
           var cursor:IViewCursor = lodgings.createCursor();
           var filter:AccommodationFilter = new AccommodationFilter();
             
            while (!cursor.afterLast)
            {
                var accommodation:Accommodation = new Accommodation();
                accommodation.fill(cursor.current); 
                temp.addItem(accommodation);
                cursor.moveNext();
            }
          
           accommodations = temp;
                    
        }

Tracy Spratt <[EMAIL PROTECTED]> wrote:
              Call it in the result handler.
  
  Either apply the filter to the main instance level variable “accomodations”, 
or do as you have and then assign selectedAccoms to the dataGrid dataProvider.
  
  Tracy
  
      
---------------------------------
  
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mathe 
Maema
Sent: Wednesday, September 05, 2007 6:57 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] newbie

  
          This is the function I thought of introducing.  I didn't introduce it 
because I couldn't really work out how it would be called if I wanted data to 
be updated automatically i.e. without a button click or something like that. 

    [Bindable]
   private var selectedAccoms:ArrayCollection;
   public function updateGrid():void
   {
   selectedAccoms = new ArrayCollection(accommodations);
   //selectedAccoms.filterFunction =;
   selectedAccoms.refresh();
   dgAccom.dataProvider = selectedAccoms;
   }

Tracy Spratt <[EMAIL PROTECTED]> wrote:

            Does your handler get called? Does it contain the reference you 
need? How are you applying the filter?  Are you calling refresh()?

    Tracy

      
---------------------------------
  
    From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Mathe Maema
Sent: Wednesday, September 05, 2007 5:54 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] newbie


            Main


      <Application>
<Script>
//sending data methods using httpservice to say var accommodations
</Script>
<SearchView id="search" lodgings={accommodations}/>
</Application>


      SearchView
<HBox>
<Script>
[Bindable]
public var lodgings:ArrayCollections;
</Script>
<filterComp id="compfil"/> 
<displayGrid id="dg" dataprovider="{lodgings}"/>
<HBox>


      filterComp
//assume it has 2 checkboxes: chk1 and chk2 which call
// dispatchFilter() when clicked
private function dispatchFilter():void
        {
            var event:FilterEvent = 
                new FilterEvent(filter, checked); //filter hold values of 
selection of chk1 & chk2
            dispatchEvent(event);
        }
        
filterEvent.as comstructor
public function FilterEvent(filter:MyFilter, live:Boolean)
    {
        super(FILTER);
        this.filter = filter;
        this.live = live;
    }
MyFilter.as
public function accept(accommodation:Accommodation):Boolean
    {
                      
        if (graded && !accommodation.graded)
         return false;
        if (backpacker && !accommodation.backpacker)
     return false;
    return true;
  }


      Above is my abbreviated code. I think my problem is that I am unsure 
about how to get the result data after filtering. In my mind the filtering 
function is working on the data retrieved using httpservice.......but I havent 
actually cracked that part well...at one point I thought of introducing a 
function for capturing selected data.....

Tracy Spratt <[EMAIL PROTECTED]> wrote:


              Ok, that is reasonable, what does not work?  Does your handler 
get called? Does it contain the reference you need?  How are you updating the 
dataProvider?


      Tracy


      
---------------------------------
  
      From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Mathe Maema
Sent: Wednesday, September 05, 2007 2:52 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] newbie



              I have two pages. The first is the main. In the main I load my  
xml data as follows using Httpservice. I pass this data to the second page as 
follows: 



        <SearchView id="searchView" label="Search"  accommodations="{accoms}" />



        // accommodations has been declared publicly in SearchView.mxml and 
accoms is the variable that was used to accept data sent by httpservice.  Once 
the data is passed, I display in the datagrid. All is fine at this stage.



        My second step was to attempt to filter the data in the datagrid and 
this is where my trouble began. I have two actionscript files one is for 
carrying out the filtering and the other is for the filterEvent. oh by the way 
there is yet another actionscript file which is essentially the class file for 
accommodations.  At this point, the following sequence of events can take place:



    
   a click on a checkbox calls a function dispatchFilter  
   the dispatch filter creates an instance of class filterevent and dispatches 
the event  
   the dispatched event takes as its parameter instance of the filter class and 
thus reviews what has been checked or unchecked..
        I tried using a get function but a while I realised that I miss 
something relating to passing data between components.



        
Tom Chiverton <[EMAIL PROTECTED]> wrote:



        On Wednesday 05 Sep 2007, [EMAIL PROTECTED] wrote:
> I am sorry no code is included. I really didn't know which part to
> include.

Be specific, and try one part at a time.
What have your tried ? Why didn't it work ?

-- 
Tom Chiverton
Helping to widespreadedly accelerate eigth-generation infrastructures
on: http://thefalken.livejournal.com

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF. A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged. If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents. If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links




        


    
---------------------------------
  
      For ideas on reducing your carbon footprint visit Yahoo! For Good this 
month. 








      

    
---------------------------------
  
    For ideas on reducing your carbon footprint visit Yahoo! For Good this 
month. 







  
    
    
---------------------------------
  
  For ideas on reducing your carbon footprint visit Yahoo! For Good this month. 




  

                         

       
---------------------------------
 For ideas on reducing your carbon footprint visit Yahoo! For Good this month.

Reply via email to