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

[Solved] TreeView No dropPosition property in onNodeDropped ?

3 Answers 155 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dylan Lin
Top achievements
Rank 1
Dylan Lin asked on 27 Sep 2010, 11:12 AM
Hi guys,

I'm using the TreeView in my webform projects. I found that e.dropPosition is undefined in onNodeDrop (NOT onNodeDropped) handler. I need to get this information, or I am not able to know whether I should cancel the drop.

Another quesiton, I want to send a ajax request onNodeDrop to determine this is a valid drop operation (If the server throw an exception, then I need to show some error message and cancel the drop operation). But the ajax request need some time to get result from the server, so I need to let the drop operation to wait for the ajax request done. When the ajax result returns to the client, I can determine whether to cancel or accept the drop operation. How can I do that? Or is there some tricks?

Thanks in advance! :)

UPDATE: Sorry, the title of this post is incorrect. The e parameter in onNodeDropped(e) handler do have the e.dropPostion property. It's the e parametere in the onNodeDrop(e) handler that don't have the e.dropPostion property.

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 28 Sep 2010, 08:39 AM
Hello Dylan,

Your request for dropPosition in the onNodeDrop event is valid and will be implemented. The validation through an AJAX, however, does not seem to work, because by the time when the AJAX request returns from the server, it would be too late to cancel the onNodeDrop event. Therefore, you'll have to cancel it always and move the node by yourself -- and the TreeView does not offer such client-side functionality yet. Is it possible to get the validation logic to execute on the client-side?

Best wishes,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dylan Lin
Top achievements
Rank 1
answered on 28 Sep 2010, 09:34 AM
Hi, Alex

Thanks for the answer, and I'm glad to hear that the team will implement e.dropPosition in onNodeDrop event.

I've summarized some more requests which I think it would be useful :D
1. getChildNodes support
2. removeNode support
3. changeText & change Value support
4. node template support for trees which are built from JSON data
5. context menu support

And I also found a bug (or it's by design?):
In the onNodeDrop event, the treeview.getItemText(e.dropTarget) will always returns an empty string. I think it's because the e.dropTarget element is not a "li" but a "div" inside the tree node "li"?
0
Accepted
Alex Gyoshev
Telerik team
answered on 29 Sep 2010, 03:58 PM
Hello Dylan,

Thank you for filing these requests. Straight to the answers:
  1. getChildNodes -- $(item).find('>.t-group').children()
  2. removeNode - logged in PITS
  3. change text/value - $(item).find('>div>.t-in').text("New text") / $(item).find('>div>:input[name="itemValue"]').val("newValue");
  4. client-side templates - logged in PITS
  5. context menu - this one is a tough one. We need a client-side API for the menu in order to achieve this, and some modifications to the menu styles. Furthermore, the context menus in web apps are generally considered bad practice and providing an alternative is strongly advised, especially if you need the application to work on touch-based devices. Therefore, the context menu is not considered high priority.
Regarding the getItemText - it is more like "by design" -- the client-side functions expect the list items as an argument. This is fixable, though - we will consider it. Until then, $(e.dropTarget).closest('.t-item').

Your Telerik points have been updated.

Regards,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Dylan Lin
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Dylan Lin
Top achievements
Rank 1
Share this question
or