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

Dropping over a node with no children and LoadOnDemand=webservice

1 Answer 25 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 07 Nov 2011, 01:23 PM
Hi,

I noticed a strange behavior: when I drop a node onto another node which has no children and is loaded on demand by a webserivce, I will have the dropped node twice.

This is what I do
- expand node A by clicking the expand icon
- node A expands and has no children (using LoadOnDemand - webservice)
- I drag node B over node A
- The change of the parent is saved in database using a webservice
- After saving, I move node B client-side in javascript from the old parent to the new parent (node A)
- node B is visible under his new parent node A
- when I collapse node A and expand it again (by using the expand icon), I see the new node twice (the first was my moving in javascript the duplicate is fetched by webservice)

If node A would has at least one child when it is expanded the first time, everything is fine.
This only occurs if the new parent node had no children before the drag&drop operation.

How can I prevent that behavior?

Edit: What currently works for me is to clear the current node's children on the OnClientNodePopulatingHandler:
function OnClientNodePopulatingHandler(sender, e) {
   e.get_node().get_nodes().clear();
}

Is there a better way to achieve this?

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 10 Nov 2011, 01:37 PM
Hi Jp,

That is an interesting scenario indeed and it seems like a good work around. Could you please specify which web service demo exactly can be used to reproduce the issue and what is the exact javascript you are using so I could reproduce it and inspect it locally?

Greetings,
Plamen Zdravkov
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
Plamen
Telerik team
Share this question
or