sábado, 8 de agosto de 2009

OpenLaszlo: dataset timeout && events problems

Have a problem with some dataset, i wanna execute query and then fast as Ana Guevara, to get the data from dataset that has been executed. But, i have a warning: timeout. This is result from next code:

//we launched the first query, and the data is store in opEnfermedades
var p=new LzParam();
p.addValue("id", "myarg1", true);
canvas.datasets.opEnfermedades.setQueryString(p);
canvas.datasets.opEnfermedades.doRequest();

//get the data from dataset
this.txtBox1.setAttribute('dataset', 'opEnfermedades:/xml/resultado[1]/@id');


The debbuger show me a timeout in txtBox1 properties, in fact the parent view apparently is correct, can see the dataset property with my xml struct and consequently the data.

I try to resolve this problem, thinking for 3 thing:
  • loop persistence: using a global var that is edited when the data is arrival (inside from a event), then a loop persistence check this var for know 'when' the data is ready. This idea i dont like, because must be using a globar var and i lost independence from clases, and my application is bloking a little bit.
  • Using a timer: When i use a timer, the data is update correctly. The bad idea is because the time to reply is changeable, in my notebook could to reply fine but in internet is very very dificult to calculate this.
  • Using Envents: i develop this. I must explain:
//we launched the first query, and the data is store in opEnfermedades
var p=new LzParam();
p.addValue("id", "myarg1", true);
canvas.datasets.opEnfermedades.setQueryString(p);
canvas.datasets.opEnfermedades.doRequest();


When the data arrival, opEnfermedades dataset make a event called "ondata", i used this event for update my text box widget, but openlaszlo acting weird, i dont know. I need this for do a second query using the data catched as param. I think that to resolv this send all data in only one query and that my view model work (PHP, JSP) for me.

I must apologize me, but my english is bad, i wish do it. I hope a comments. Tnx.