Welcome Guest Search | Active Topics | Sign In | Register

EO_Callback Query Options
PThompson
Posted: Friday, October 9, 2009 4:37:54 AM
Rank: Advanced Member
Groups: Member

Joined: 10/31/2007
Posts: 51
Hi

Can you use a eo_callback function in the client function used by the ClientSideAfterExecute or ClientSideAfterUpdate of a callbackpanel?

I have a callback panel that when triggered I want to perform a server side evaluation then on completeion use the client function for either ClientSideAfterExecute or ClientSideAfterUpdate to query the user then run the eo_callback function of the same callbackpanel that fired the client function.

Is this possible or right?

At the moment I get the following message when the eo_callback in the client function is executed.

"EO.Web Controls Client Side Debug Message

Callback object with ID '[object Object]' does not exist.

You can turn off this message by setting EO.Web.Runtime.DebugLevel to 0 (Not recommended for debug build)"

Thanks


p.s here's a sample of the code

Server Callback

protected void cbpDealCommands_Execute(object sender, EO.Web.CallbackEventArgs e)
{
string trigger = e.Parameter;
try
{
switch(trigger)
{
case "Update":
bool isRegenTriggered = true;
if (isRegenTriggered)
{
e.Data = "REGEN";
return;
}
else if (Update())
e.Data = "RESET";

}
break;
case "UpdateRegen": //GPS3 6 Apply Territory Auto Regenerate
{
if (UpdateDeal())
e.Data = "RESET";
}
break;
}
}
catch(Exception Ex)
{
DisplayExceptionMessage(Ex.Message, this.lblStatusMessage);
}

Client Callback function

function CBPAfterExeHdlr(callbackPanel, output, extraData) {
var trigger = callbackPanel.getParam()

switch (extraData) {
case "RESET":
SetPageClean();
break;
case "REGEN":
var ret = confirm("Are you sure you want to do this?");
if (ret) {
var cbp = eo_GetObject("cbpDealCommands");
eo_Callback(callbackPanel, "UpdateRegen");
}
break;
}

}




eo_support
Posted: Friday, October 9, 2009 9:19:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can not. You will need to use setTimeout to delay the call. It will be something like this:

Code: JavaScript
setTimeout(function()
{
    eo_Callback(callbakPanel, "UpdateRegen");
}, 100);


Thanks!
PThompson
Posted: Friday, October 9, 2009 11:19:06 AM
Rank: Advanced Member
Groups: Member

Joined: 10/31/2007
Posts: 51
Hi

I'm a little confused.

I've changed the javascript to:

function CBPAfterExeHdlr(callbackPanel, output, extraData) {
var trigger = callbackPanel.getParam()

switch (extraData) {
case "RESET":
SetPageClean();
break;
case "REGEN":
var ret = confirm("Are you sure you want to do this?");
if (ret) {
setTimeout(function() { eo_Callback(callbackPanel, "UpdateRegen"); }, 100);
}
break;
}
}

And the same thing occurs not sure what you are suggesting. The callbackpanel I'm using in the eo_callback is the same callbackpanel that called the CBPAfterExeHdlr function.

What I want to do is make an evaluation on the server before confirming with the user client side to trigger a server side update.
eo_support
Posted: Friday, October 9, 2009 12:00:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Check the first argument you pass to eo_Callback. It should be a string value. For example, if you have a CallbackPanel with ID "Callback1", then the following code is valid:

Code: JavaScript
var s = "Callback1";
eo_Callback(s, "anything");


The following code is also valid:
Code: JavaScript
eo_Callback("Callback1", "anything");


This is NOT valid:
Code: JavaScript
//This code is not valid because Callback1 is not a string
eo_Callback(Callback1, "anything");


Note setTimeout is still needed because you can not trigger a second callback before the first callback is completely done.

If you still have any questions, there will be a fee for additional support because your current support period has already expired in May.

Thanks!
PThompson
Posted: Friday, October 9, 2009 12:16:56 PM
Rank: Advanced Member
Groups: Member

Joined: 10/31/2007
Posts: 51
Ahhh!.

I see my mistake I passed the callbackpanel object not the id as a string. Yes stupid mistake.


With regards to support I thought this was a free forum regardless of membership or purchase of the product.
eo_support
Posted: Friday, October 9, 2009 12:30:29 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
PThompson wrote:
With regards to support I thought this was a free forum regardless of membership or purchase of the product.
Not exactly. :) The forum is free for anyone to post (both question and answers) regardless of membership or purchase. However official support from us (eo_support) does check your purchase status. We usually don't mind to point you to the right direction even after your support period expired, but just wanted you to be aware that the official support period is actual one year only.


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.