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

[Solved] Selecting an item when dragging

1 Answer 33 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kuangyi
Top achievements
Rank 1
Kuangyi asked on 17 Oct 2011, 03:33 PM
Hi, what is the best way to select an item when I start dragging it?

ie: I have a treeview with drag+drop enabled, and I select item 1.  However I mousedown + drag item 2, item 1 is still selected!

I tried using onNodeDragStart to do my UI changes + event calls, however that function doesn't fire until you actually start the dragging movement.

I suppose I'm wondering what the best way to implement onMouseDown for it is, should I just wire up an event on the page load to check for mouseDown on the treeview elements?

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 18 Oct 2011, 08:21 AM
Hi Kuangyi,

The following code will select the treeview item on mousedown:

$(".t-in").mousedown(function() {
    $(this).closest(".t-treeview").find(".t-in").removeClass("t-state-selected t-state-hover");
    $(this).addClass("t-state-selected");
});


All the best,
Alex Gyoshev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
TreeView
Asked by
Kuangyi
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or