Tracy, thanks for your reply. It looks like you are becoming my personam
trainer.
The way you described is moreless the way I set it up. But because I
could not get it working, I was thinking of using 2 AC's. It looked more
simple to me.
However, I will keep using only 1 AC, but unfortunately I need some help
again.

This is my code :

public function showRecord(pViewMode:String):void {
       switch (pViewMode) {
            case AVAILABLE_RECORDS :
                 this._records.filterFunction = getAvailableRecords;
                 this._records.refresh();
                 break;
           case DELETED_RECORDS:
                 this._records.filterFunction = getDeletedRecords;
                 this._records.refresh();
                 break;
       }
}

private function getAvailableRecords (obj:Object):Boolean {
      return obj["flagForDeletion"].match('false');
}


I always get the error value is not a function on line return
obj["flagForDeletion"]
I also tried matching :
      - false
      - 'false'
      - "false"
      - 0
but no difference.

What I did before :
My field flagForDeletion in Flex is of type boolean, but the same field
is of type tinyInt in my mySQL-database.
When requestion the records from the DB, I convert the 0 or 1 to false /
true, before dropping them into the AC.

Hope my explanation is sufficient enough.

Thanks again

PS : Can you post a little piece of code how to combine 2 criteria in
one filterfunction?

--- In [email protected], "Tracy Spratt" <tr...@...> wrote:
>
> Use a single AC, and just have both criteria in the filter function.
Maybe
> have an instance variable indicating the mode, and in the filter,
> conditionally apply the deleted flag criteria.
>
>
>
> Tracy Spratt,
>
> Lariat Services, development services available
>
> _____
>
> From: [email protected] [mailto:[email protected]]
On
> Behalf Of secrit.service
> Sent: Friday, April 24, 2009 3:30 AM
> To: [email protected]
> Subject: [flexcoders] Datagid : filterfunction
>
>
>
>
>
>
>
>
> Hello all,
>
> I have a table in my DB containing following fields :
> - ID
> - aText : String
> - flaggedForDeletion : Boolean
>
> Suppose all my records have a value of false for field
flaggedForDeletion.
>
> In my application I have a datagrid and a recycleBin-button.
>
> My intention is to create following :
> When starting my application, the datagrid shows all the records of
the DB.
> When I drag a record from the datagrid to the recycleBin, it gets the
value
> true for field flaggedForDeletion and will be removed from the
datagrid.
> When clicking on the recycleBin-button, the datagrid has to show only
these
> records which are flagged for deletion. Leaving the recycleBin-mode,
the
> datagrid has to show only these records which are NOT flaged for
deletion.
>
> My question is now how to do this : To my opinion I have 2
possibilities :
> - using 2 ArrayCollections (acAvailableRecords and acDeletedRecords)
> Depending what I want to show, I dynamically change the datasource of
my
> datagrid
> - using only one ArrayCollection and filter it based on the value of
> flaggedForDeletion.
>
> I case of the last solution, I encounter another issue, meaning : I
also
> provided a filterfunction on the datagrid to filter the records based
on a
> string I fill in a searchfield. This means I need to create a double
> filterfunction : one on field flaggedForDeletion and the other on the
> content of the searchfield.
>
> No idea which is the best solution and if I can use a double filter on
a
> datagridsource.
>
> Any help is welcome.
> Thanks in advance.
>


Reply via email to