This is a migrated thread and some comments may be shown as answers.

JScript error from DragDrop

2 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 03 Jul 2008, 01:15 PM

I have a Drag Drop operation that works OK except that it causes a Javascript error.

I am dragging a row of a RadGrid onto a Tree control (not a RadTree). When I do the drop onto the Tree control, the RadGrid's onRowDropping handler fires and does:

args.set_cancel(true);

(otherwise I get a different JScript error: Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex)

Dropping the item onto the Tree control causes the Tree to do an asynchronous callback which executes as I want, and in a subsequent PageLoad I rebind the RadGrid. But shortly afterwards I get a JScript error message from the following Telerik function:

function WebForm_CallbackComplete() {
    for (i = 0; i < __pendingCallbacks.length; i++) {
        callbackObject = __pendingCallbacks[i];
        if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
            WebForm_ExecuteCallback(callbackObject);
            if (!__pendingCallbacks[i].async) {
                __synchronousCallBackIndex = -1;
            }
            __pendingCallbacks[i] = null;
            var callbackFrameID = "__CALLBACKFRAME" + i;
            var xmlRequestFrame = document.getElementById(callbackFrameID);
            if (xmlRequestFrame) {
                xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
            }
        }
    }
}

In this function, the line:

            if (!__pendingCallbacks[i].async) {

is giving an error message because i = 0 and __pendingCallbacks[0] is null, so of course __pendingCallbacks[0].async "is null or not an object".

I don't understand all the details of this function (presumably the call to WebForm_ExecuteCallback(callbackObject) has somehow set __pendingCallbacks[i] to null?), but it looks to me as if the error could be avoided by simply replacing that line of code by:

            if (__pendingCallbacks[i] && !__pendingCallbacks[i].async) {

Does this look reasonable and if so how can I best make the change?

2 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 07 Jul 2008, 01:28 PM
Hello Ben,

Please find how to override the WebForm_CallbackComplete() method and resolve the described problem in this article.

For more information about drag and drop of grid items review this help topic.

Let us know how it goes.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ben
Top achievements
Rank 1
answered on 07 Jul 2008, 04:11 PM
Iana,
Thanks very much. This completely solves my problem.
Ben
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Ben
Top achievements
Rank 1
Share this question
or