What is the best practice to filter data?

andreas's Avatar


28 Oct, 2011 08:51 AM

I have a list of incomming and outgoing messages that a service writes into a model.
I want to show a list of all messages in one view and the sorted data of incomming and outgoing in 2 other views.
Where do I filter the data?
1. In the Model where I have all data and 2 functions that return the filtered incomming and outgoing
2. In a Controller that contain 2 lists (ongoing and incomming)
3. In the Mediator (every view has the same dataProvider but different filterFunction)

And if I omit the all-list and show just the incomming and outgoing where is the best place then?
I think directly having 2 lists in the model for incomming and outgoing would be best?

  1. Support Staff 1 Posted by Ondina D.F. on 01 Nov, 2011 01:55 PM

    Ondina D.F.'s Avatar

    Hi Brean,

    Just wanted to let you know, that, for some reason, there was a spam filter issue on the robotlegs forum.
    That’s why a few posts were visible on the list, but couldn’t be opened, therefore they got no answers.
    Your post was one of them. Sorry for the inconvenience.
    You’ll get an answer pretty soon :)


  2. 2 Posted by krasimir on 01 Nov, 2011 03:02 PM

    krasimir's Avatar

    Hello Brean,

    if I was on your place I'll create a helper class. For example DataSorter. I'm not sure about the nature of your data, but my feeling is that such a sorting is not exactly for the model. Of course if your data is actually a collection of complex VO objects then maybe it will be better to put it there.
    By creating a helper with a nice API you will be able to use this class in some other projects.

  3. 3 Posted by andreas on 01 Nov, 2011 03:20 PM

    andreas's Avatar

    My Question is about a week old, I already solved it:
    I am using Sort/SortField from mx.collections in the view http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/...
    and use the same arraycollection for both, incomming and outgoing messages but with different filterFunctions.
    This is view-logic after all (just present the data to the user).

  4. Support Staff 4 Posted by Ondina D.F. on 01 Nov, 2011 03:51 PM

    Ondina D.F.'s Avatar

    Hi Brean,

    Glad you solved your issue.
    Don’t hesitate to ask other questions, if you have any.
    The robotlegs community is eager to help.
    The delay in response to this discussion was due to pure technical issues. Sorry again for the inconvenience :)


  5. andreas closed this discussion on 03 Nov, 2011 04:16 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac