Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
NormanL  
#1 Posted : Wednesday, August 22, 2012 8:43:48 AM(UTC)
NormanL

Rank: Advanced Member

Groups: Member
Joined: 4/26/2012(UTC)
Posts: 36

Thanks: 6 times
Hi,

I have two CanvasViewers on my page and I'm trying to execute a remote method against both in turn but I'm running into some problems and I think its because I'm not waiting for one opertion to complete before performing the next?

My client side function looks like the following:

Quote:
function MyFunction(canvasViewerIds) {
var params = new Array();
params.push('param1', 'param2', '');
for (i = 0; i < canvasViewerIds.length; i++) {
params[2] = 'some value'; // value different for each pass; not shown for brevity
var canvasViewer = $find(canvasViewerIds[i]);
canvasViewer.invokeRemoteMethod('MyRemoteMethod', params);
//alert('here');
}
}


The function accepts an array of CanvasViewer ids (e.g. '_clientViewer1', '_clientViewer2'). The 'MyRemoteMethod' method updates a single CanvasViewer (e.g. changes the current image or similar).

If I pass just one id (i.e. '_clientViewer1' or '_clientViewer2') everything works as expected. However, if I pass both ids then only the second viewer is updated successfully. If I uncomment the alert above I get to it before the operation is complete (or at least before the canvas viewer is updated). How do I wait until I'm sure the first call has completed? I've seen reference to statusChanged event and get_status but I'm not sure (a) if they can help or (b) how to implement them in this case.

Any help would be gratefully received.

Thanks
Dmitry.Obukhov  
#2 Posted : Thursday, August 23, 2012 11:47:18 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups:
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Hi Norman,

I thought a couple of hours how get_status may help you, but it seem there is no way. I would like to recommend you to implement only separated javascript functions for each canvasviewer to call the remote method.
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.