Fooberichu
Top achievements
Rank 2
Fooberichu
asked on 08 Jan 2008, 07:34 PM
Using the PrometheusExamples and the DialogReturnValue example, if I use the OnClientClose method and actually try to pull the radWindow.Argument, all it returns in an alert statement is [object Object]. The text on the control is correctly being set, but that is happening through the CallBackFunction (using the returnValue).
So why is it that the text is coming back as [object Object]? The example states that you can use several different variants, variant 1, as per the example, states that you can pass something in the radWindow.close(), such as radWindow.close('some text'); Again, that 'some text' comes back as an [object Object] -- so how do I get it to be a string?
Thanks,
So why is it that the text is coming back as [object Object]? The example states that you can use several different variants, variant 1, as per the example, states that you can pass something in the radWindow.close(), such as radWindow.close('some text'); Again, that 'some text' comes back as an [object Object] -- so how do I get it to be a string?
Thanks,
4 Answers, 1 is accepted
0
Fooberichu
Top achievements
Rank 2
answered on 08 Jan 2008, 07:48 PM
So I did some digging and ended up just using the ClientCallBackFunction as I saw in another thread and I saw that the example was doing. My question is why the heck would I bother using the OnClientClose function at this point if I can't access the argument? The example implies that you can actually do so because it says (in the DefaultCS.aspx file):
//Another option for passing a callback value
//Set the radWindow.Argument property in the dialog
//And read it here --> var oValue = radWindow.Argument;
//Do cleanup if necessary
Problem with that is you can't actually get it. So the example either needs that removed from it -OR- that problem needs fixing.
Thanks
//Another option for passing a callback value
//Set the radWindow.Argument property in the dialog
//And read it here --> var oValue = radWindow.Argument;
//Do cleanup if necessary
Problem with that is you can't actually get it. So the example either needs that removed from it -OR- that problem needs fixing.
Thanks
0
Hi Fooberichu,
Can you please specify how exactly do you set the argument in the dialog? I am asking you this because if you set it like this:
function SendAndClose(text)
{
var radWindow = GetRadWindow();
radWindow.argument = text;
radWindow.close();
}
you need to get the argument in the OnClientClose function in the same way, e.g
function OnClientClose(oWnd)
{
alert(oWnd.argument);
}
For your convenience I've attached a small sample to this thread that shows this logic in action.
All the best,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Can you please specify how exactly do you set the argument in the dialog? I am asking you this because if you set it like this:
function SendAndClose(text)
{
var radWindow = GetRadWindow();
radWindow.argument = text;
radWindow.close();
}
you need to get the argument in the OnClientClose function in the same way, e.g
function OnClientClose(oWnd)
{
alert(oWnd.argument);
}
For your convenience I've attached a small sample to this thread that shows this logic in action.
All the best,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Fooberichu
Top achievements
Rank 2
answered on 09 Jan 2008, 04:35 PM
I should requalify what I meant... I can "get" the argument but it is returned as [object Object] if I use it during the OnClientClose method. If I use it as a return value through the CallBackFunction, it shows up just fine. I'm using the following javascript to pass it:
GetRadWindow().Close("someValue");
Then the function to retrieve that was:
function schedulerOnClientClose(radWindow){
var oValue = radWindow.Argument;
if (oValue && oValue == 'refresh'){
var ajaxmanager = $find("ajaxManager"); // this is actually set in code behind and populates the ajaxmanager client id
ajaxmanager.AjaxRequest('RebindScheduler');
}
}
so the problem with the above is that it would get an oValue but it was always setting it to [object Object] and thus the scheduler would never refresh. I removed the call to OnClientClose and replaced it with a call to ClientCallBackFunction of the following:
function CallBackFunction(radWindow, returnValue) {
if (returnValue && returnValue == 'refresh') {
var ajaxmanager = $find("ajaxmanager");
ajaxmanager.AjaxRequest('RebindScheduler');
}
}
which does work for me. I just wonder why the other one doesn't (and if I go into the actual DialogReturnValue example and do the exact same stuff, it also returns [object Object].
Thanks in advance
GetRadWindow().Close("someValue");
Then the function to retrieve that was:
function schedulerOnClientClose(radWindow){
var oValue = radWindow.Argument;
if (oValue && oValue == 'refresh'){
var ajaxmanager = $find("ajaxManager"); // this is actually set in code behind and populates the ajaxmanager client id
ajaxmanager.AjaxRequest('RebindScheduler');
}
}
so the problem with the above is that it would get an oValue but it was always setting it to [object Object] and thus the scheduler would never refresh. I removed the call to OnClientClose and replaced it with a call to ClientCallBackFunction of the following:
function CallBackFunction(radWindow, returnValue) {
if (returnValue && returnValue == 'refresh') {
var ajaxmanager = $find("ajaxmanager");
ajaxmanager.AjaxRequest('RebindScheduler');
}
}
which does work for me. I just wonder why the other one doesn't (and if I go into the actual DialogReturnValue example and do the exact same stuff, it also returns [object Object].
Thanks in advance
0
Hello Fooberichu,
Indeed you are right - unlike the standard version of the control when sending the argument in the close() method with RadWindow Prometheus, you can read it properly only in the ClientCallBackFunction.
We consider this a bug on our side and we will improve the behavior of the control in one of the following updates so it works like the classic version in that case.
Thank you for bringing this problem to our attention. Your points were updated.
Sincerely yours,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Indeed you are right - unlike the standard version of the control when sending the argument in the close() method with RadWindow Prometheus, you can read it properly only in the ClientCallBackFunction.
We consider this a bug on our side and we will improve the behavior of the control in one of the following updates so it works like the classic version in that case.
Thank you for bringing this problem to our attention. Your points were updated.
Sincerely yours,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center