View Full Version : Displaying component after data received
slledru
09-28-2006, 09:09 AM
I am new to this forum and I am hoping any of you can help me.
I have a code that displays a button. For onclick event, I have:
<method event="onclick">
var d = canvas.datasets.dsNewData;
var p = new LzParam();
d.setQueryString(p);
Debug.write(p);
d.doRequest();
</method>
When data is received from HTTP request, I want to call: new_view.setAttribute('visible',true);
so that new_view can be displayed.
I've tried enclosing the above in <method event="ondata"...> but doesn't seem to work. Any advice?
notzippy
09-28-2006, 09:41 AM
2 things
1) In the dataset definition add the ** ondata="mymethod()" ** mymethod will be called when the dataset is loaded
2) <method event="onevent"> is deprecated use <handler name="onevent"> instead
And it wouldnt hurt to read the 400 page developers guide ..
slledru
09-28-2006, 09:50 AM
I tried ondata="mymethod()" and the method is not being called.
I've defined the method under canvas just to make sure:
<method name="display">
Debug.write("am I here?");
new_view.setAttribute('visible',true);
</method>
And in my dataset:
<dataset name="dsNewData" type="http" .... request="false"
ondata="canvas.display()" />
notzippy
09-28-2006, 09:57 AM
Try reading section 3.4 of the developers manual. It has a sample of setting the src and using the ondata
http://www.openlaszlo.org/lps-latest/docs/guide/databinding.html
slledru
09-28-2006, 11:51 AM
This is quite frustrating. I thought I must be misunderstanding this whole data binding business and went back the guide and create a simple servlet that sleeps for 5 seconds and returning data. And I used the example attached and ondata event is issued and everything is fine.
But when I am back to my product that I am currently working on, I do NOT receive ondata event.
Can someone advise me on how to debug this problem?
gplas
09-30-2006, 12:02 PM
I played a bit with your file, seems like it works like you want this way. You'll notice the difference.
Notice that
'ondata' event is triggered when the first data starts comming in, it's not triggered at the succesful end of the dataload...
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.