I would...
 
1) set some variable in some model when the user selects something in the tree
 
2) in command, gather everything the user seleted and build your query
 
Then obviously send to server side, get results, display in grid.
 
Dimitrios Gianninas
RIA Developer
Optimal Payments Inc.
 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
jamiebadman
Sent: Monday, January 22, 2007 7:31 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ViewHelper is dead ? So what's the 'best practice' 
here... ?



Hi,

I'm currently implementing an app in Cairngorm 2.1 and I've hit a 
kind of brick wall that wouldn't have existed in 0.99...

I'm led to believe that we should no longer use 
ViewHelper/ViewLocator in V2.1 and instead rely more on data binding 
to control everything... so here's the problem...

I have a treeView. In another mxml file I have a 'selection' screen 
which builds a SQL query up based on things the user does. This is 
then fired off and the results displayed in a table. Don't panic! 
This will all be converted to formal webservices later, so 
the 'inline' SQL will go away - this is just a quick prototype.

But anyway... here's the thing...

In mxml_1 we have the treeview. In mxml_2 we have the selection 
screen and a function which constructs the SQL based on the values 
of fields on the screen. We also have the firing of an event to send 
the constructed query to the db. The grid is bound to an array 
collection which is constructed when the command result is invoked.

One of the selection criteria is the branch of the treeview the user 
is currently on...

So when the user selects another branch on the treeview, what I need 
to happen is the sql construction function should be fired on mxml_2 
which in turn retrieves the new SQL which is then displayed in the 
table.

The problem I have is, how can I cause the function on mxml_2 to 
fire ?

Once upon a time I could have simply used viewLocator to find the 
mxml_2ViewHelper and fired a function on there...

But now... how can this work via databinding ?

I already have an int defined in the AppModelLocator which 
represents the id of the current branch - but you can't add 
a 'change' listener to an int - only ArrayCollections as far as I 
can see. I *could* store this info in an ArrayCollection and have a 
listener on that - but this seems pretty clunky and I'm sure there's 
a much more 'correct' way to go about doing this in Cairngorm.

Another way I can do this is to invoke the function directly on 
mxml_2, from mxml_1. I can do this because mxml_1 is in fact part of 
a viewStack on mxml_1. However, is this the 'correct' way ? This is 
how I'm currently doing it, because at least it works - but I really 
want to build this application as closely to the Cairngorm 'ideal' 
as I possibly can.

The docs on Cairngorm seem to be extremely sparse and none of the 
examples I've seen so far illustrate how this situation should be 
handled.

Can someone please provide me with some guidance as to what's 
the 'best practice' here ?

Many thanks,

Jamie.



 

-- 
WARNING
-------
This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient.  No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message.  If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system.  The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful.  If you have received this e-mail in error, please notify the 
sender.

AVIS IMPORTANT
--------------
Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé.  L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation.  Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système.  La lecture, la distribution, la copie ou 
tout autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux.  Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.

Reply via email to