Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Search accross multiple models MVC compliant  (Read 4353 times)
kilgore
Newbie
*
Posts: 3


View Profile WWW Email
« on: May 26, 2008, 11:00:33 »

Hello,

I'm new to Flex, AS3 and PureMVC but not to MVC architecture.

I try to use an autocomplete field to do a search accross multiple models (2 for the moment but could be much more soon) and I don't know how to build that respecting the pureMVC best practises.

What do you think about that :
  • fill a SearchVO from a command with data from my different models (let's say Contact and Address)
  • dispatch a notification so my search panel mediator update the dataprovider of the autocomplete with data from the proxy
  • dispatch a notification when user hit the enter button in the notification field and run a command which try to find what the user search
  • dispatch a notification depending on the result of the change (CONTACT_FOUND, ADDRESS_FOUND, NOTHING_FOUND) so Mediator can update accordingly

Regards
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: May 26, 2008, 05:25:21 »

Sounds about right.

-=Cliff>
Logged
kilgore
Newbie
*
Posts: 3


View Profile WWW Email
« Reply #2 on: May 27, 2008, 02:16:19 »

It won't be better to use a SearchProxy rather than a SearchCommand and to fill the Vo from the proxy with data from other Proxy (ContactProxy and AddressProxy) ?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: May 27, 2008, 05:39:06 »

Sure, that'll work just fine. It could go in a SearchProxy or a SearchCommand.

Actually, though I don't like Commands that much, this is probably more appropriate in a Command. Since the combined data on the VO is not really a domain object but a value object with pieces of data from other domain objects, the assembly of that data to support the view should be done by a Command.

-=Cliff>   
Logged
Pages: [1]
Print