This project is read-only.

Treeview multiselect

Nov 6, 2012 at 10:06 AM

Multi select child nodes in the treeview

I would like to know if it is possible to allow users to select multiple elements inside a treeview section and then move them into any other section. Right now user needs to move the individual document by drag drop mechanism.


For example


  -Section 1

      -document 1

      -document 2

      -document 3

 -Section 2

now i want to be able to select document 2 and document 3 and move them together into Section 2.

this will help in case where the section 1 contains around 100 documents and i want to move around 40 documents of similar types into a new section.

Nov 6, 2012 at 11:42 AM

Implementing this with drag and drop make no sense since the selected nodes maybe very far from each others. A good solution might be selecting the nodes to move someway, and then selecting the father to move them and performing the operation by clicking on something. For instance the future father might have an add child button that add all selected nodes.


You can add this by adding the needed buttons to the node templates(add children and select node) Then you bind an handler in the root of the tree (or any other node containing the tree) and do $('li') to find the li root of the node that caused the click. Once you have the list of all selected nodes you can perform the move by using the MvcControlsToolkit_TreeView_Move(item, target, after) function of the client side api.

However, in my opinion the above solution is not very satisfactory...there is not too much difference in selecting a node and moving it to the new father...of course selection is more immediate since it requires a single click but still this way it is a big job. A better solution might be to use a textbos to "filter " all nodes on some criteria:

1) you select the old father,

2) you write something in the "search box" all selected node appears in a selected state(for instance by changing their background color)

3) when you are satified with the selection you select the add children button of another node.

Of course there are also other ways to perform the operation...

If you come out with a proposal that is "general enough" I may consider implementing it as standard behaviour. Both the above solutions, are not "general enough" and the specific way to implement them may depend on the application, but there might be better way that can be used "in general".