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

DOM error in client side dispose if nodes were removed

3 Answers 42 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 27 Oct 2011, 01:42 PM
Hi,

my tree has the possibility to remove nodes client-side (by using the context menu).
The tree itself is in a control which is in a jquery ui dialog.

When the jquery dialog gets closed and nodes were removed, I get the following error:
Error: NOT_FOUND_ERR: DOM Exception 8
This happens in ScriptResource.axd here:
a.RadContextMenu.prototype = {initialize: function() {
......
},attachContextMenu: function() {
            if (!this._detached) {
                return;
            }
            this._getContextMenuElement().parentNode.removeChild(this._getContextMenuElement());
            this.get_element().insertBefore(this._getContextMenuElement(), $get(this.get_clientStateFieldID()));
The last line causes the error. In the callstack in chrome I can see that the tree is disposing itself. The code is only called if at least one node was removed.
This is the callstack:

a.RadContextMenu.attachContextMenu() at ScriptResource.axd:345a.
RadContextMenu.dispose() at ScriptResource.axd:116
Sys$_Application$dispose() at ScriptResource.axd:5200
Sys$_Application$_unloadHandler() at ScriptResource.axd:5488
(anonymous function)() at ScriptResource.axd:49
Sys$UI$DomEvent$addHandler.browserHandler() at ScriptResource.axd:4357


This is the client-side code which removes the node:

function OnCatalogTreeMenuItemClicked(sender, e) {
   var node = e.get_node();
   var value = e.get_menuItem().get_value();
 
   if (value == "delete") {
      sender.trackChanges();
      var attributes = node.get_attributes();
      attributes.setAttribute("Type", "Deleted");
      attributes.setAttribute("HasChanged", "true");
      node.set_visible(false);
      sender.commitChanges();
   }
 
   e.get_menuItem().get_menu().hide();
}

When the jquery ui dialog is closed, I remove the nodes server-side from the database.

Is there a problem in my javascript function for removing nodes?
Or is it possible that the dispose is called after the the jquery ui dialog contents were removed from the DOM? But why only in case that nodes were removed?

Thanks for your help.

3 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 01 Nov 2011, 12:07 PM
Hello Jp,

The experienced problem seems like a bug, but in order to verify this, please open a support ticket and provide a runnable sample project with the issue being reproduce so we could debug it locally.

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
JP
Top achievements
Rank 1
answered on 02 Nov 2011, 04:26 PM
Hi,

I tried to use 
node.get_parent().get_nodes().remove(node);
instead of 
node.set_visible(false);

for removing a node but this raises the same error.


Unfortunately I can't provide a runable sample because there is many other code in different assemblies which is related to the project I am currently working on. 
Extracting the necessary code for a simple example would take days.
But if possible I could help you finding the bug in another way?
Is it ok to submit a ticket even if I can't provide an example?
 
Thanks for your help!
0
Dimitar Terziev
Telerik team
answered on 07 Nov 2011, 11:26 AM
Hello Jp,

Could you please try to remove the jQuery UI dialog and check whether the same error occurs?

Best wishes,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeView
Asked by
JP
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
JP
Top achievements
Rank 1
Share this question
or