Ok I see your point. However it is really a bad idea to make a service call for 
each row. You need to perform validation on client side if possible. Having 
server calls for each row will be a performance penalty for your app if you'll 
have many rows to validate. (You can still keep data validation o server client 
code can be de-compiled and read by anyone). If the validation logic is too 
complex and all stored into db (as I gather from here "I take information from 
the row and do some complex queries from about 20+tables with PL/SQL"), then 
send a batch of rows to the java method and validate them all at once as I said 
earlier. It really depends on your architecture ... I kind of always was able 
to 
have enough business logic on the client to avoid unnecessary calls to the 
server. In your case It might be impossible if java needs to talk to db for 
validation. Normally you should have a java layer to handle that business logic 
and only commit to db if data is valid. If so it would be easy to have that 
logic duplicated on client side, and you'll be happy cause you avoid calls and 
will cal java/lcds only on save button click. Otherwise probably sending the 
whole datagrid at once will solve your issue... 


Still if you allow user to input directly into rows is like filling a form 
you'll need to perform at least some basic validation on the cell's focus 
out....

HTH,
C




________________________________
From: Adnan <ad...@green.ba>
To: flexcoders@yahoogroups.com
Sent: Tue, August 10, 2010 4:35:28 PM
Subject: [flexcoders] Re: Flex 4: addEventListener in loop

   
The datagrid is editable and populated directly, once I hit the save button I 
need to validate the data, I take information from the row and do some complex 
queries from about 20+tables with PL/SQL, comparing some values and so on, so 
if 
the values are correct I save that row using a service from LCDS.

hope this helps?

Sending the whole datagrid data once to java? hm, seems to be a good idea

--- In flexcoders@yahoogroups.com, claudiu ursica <the_bran...@...> wrote:
>
> 
> 
> Why are you calling java can't you just validate on client?
> Presumably not... can't you just pass the whole datagrid data once to java 
> and 

> perform once there the validation?
> 
> How do you populate the datagrid in the first place? If you get data from the 
> server you should already have it valid ...
> 
> Share more info on this if you can,
> C
> 
> 
> 
> ________________________________
> From: Adnan <ad...@...>
> To: flexcoders@yahoogroups.com
> Sent: Tue, August 10, 2010 3:58:35 PM
> Subject: [flexcoders] Flex 4: addEventListener in loop
> 
> 
> Hello,
> 
> I have a for loop like (pseudocode);
> 
> for (var i:int=0; i < 10; i++) 
> {
> callJava.method(i);
> callJava.addEventListener("result", finalMethod);
> 
> if (finallMethod) == "VAL: 1"; //validation failled, break the loop
> }
> 
> private function finalMethod(e:ResultEvent):String
> {
> return "VAL: " + e.currentTarget.lastResult;
> }
> 
> The loop is called to validate rows in a datagrid. I am fetching each row and 
> the performing a check using a Java method, if the test passes, I need to 
> continue to take the next row and so on. There is no point to waste time on 
> looping thru 10 rows if the validation falls on the first row and so on. 
> 
> 
> How can I handle this case in flex, as my call/result is asynchronous and I 
>will 
>
> get it few milliseconds later, by the time I get the result for the first 
> value 
>
> my loop will already have completed.
> 
> All help is appropriated.
> Thanx,
> Adnan
>


 


      

Reply via email to