jstree Drag node is not selected - jstree

I can click on a node to select it, it marks node as selected.
Multi select works great as well.
I can then drag the selected node(s)
However, without the above mentioned selection Dragging a node does not select
it (.bind("select_node.jstree", function (e, data) only fires on mouseup)
If i have nodes selected and then drag another node ; these previously selected nodes are not deselected.
Basically,how do i emulate windows explorer drag and drop functionality ?

to deselect the previously selected nodes, just call this function before selecting the current node.
$("#tree").jstree("deselect_all");
Call the above function and then go on with selecting the current node followed by your code.
Cheers!

Related

VsCode extension. How to select a tree view item on right click

I am writitng a VsCode extension. When the user Right Clicks on an item in the tree view, he gets the popup command, whose actions apply to the previously selected item. In VsCode itself, this isn't the case. RightCliking on New File, for instance, adds a file to the currently highlighted folder (Not the selected one). How can I replicate this behavior in my extensions?
I found the solution.
When registering the command, which the right-click runs, add a parameter which is the Tree Node. When the command is invoked via the menu popup, this tree node will be the highlighted node, and not the selected node.
For example replace the code
commands.registerCommand('myExtension.myCommand', () => this.command());
and later on:
command() {
}
with
commands.registerCommand('myExtension.myCommand', command(), this);
and later on:
command(node: TreeNode) {
if (node) {
}
}
The if (node) is necessary, if the command may be invoked from a different context (like a button), in which case node would be undefined.

SAPUI5 VizFrame: How to get the selected data points

I used a VizFrame to display data in my project.
The normal behaviour of the VizFrame when you select data in the graph you see a popover with the data of the selected point. When you select more than one point the content of the popover is something like in the screenshot: popover content.
I tried using attaching myself to the SelectedData Event. The oControlEvent.mParameters contain the data nodes being currently selected for THAT event.
For example: I click node A => the node A is in the oControlEvent.mParameters. => OK
Then I click additionally on node B (so node A and B are selected) => only the node B is contained in the oControlEvent.mParameters. => not OK.
What I need is the set of all nodes that are currently selected in the graph, not just the one that triggered the event.
This information must be contained somewhere, as the Tooltip correctly shows "2 data nodes selected" after the user clicked B.
Thanks for your help.
the oControlEvent.mParameters.data, or oControlEvent.getParameter('data') will (correctly) only contain the elements that actually triggered the event. (may be more than one data point if you select several data points in one go by dragging a rectangular area over the data points)
if you need all currently selected data points, use oControlEvent.getSource().vizSelection() (here, getSource() will return the vizFrame)
Cheers, iPirat

Keep node selection from spreading to PropertySheet

I'm developing an application based on the netbeans platform.
The problem I'm having is this; I have a TopComponent that contains two panels, A and B, each with a ExplorerManager. I have two BeanTreeViews in each panel with different sets of nodes. When I change selection in the A panel, the nodes in the B panel will be created. Now, I'd like to be able to select a node in the B panel and see it's properties in the default property view. But I still have a selected node in the A panel, and therefore the property view only says 'Multiple objects.' Is there any way to keep the selection in the A panel from spreading to the PropertyView?
I'd like to be able to use NodeActions on both sets of nodes, and therefore I've added
associateLookup(new ProxyLookup(
ExplorerUtils.createLookup(PanelA.getExlporerManager(), map),
ExplorerUtils.createLookup(PanelB.getExplorerManager(), map)
));
to the TopComponent if i only associate PanelA's ExplorerManager then this isn't a problem.
Ok some after testing around I found a solution that works for me. Perhaps I was a bit quick to post this question. Anyway;
In the TopComponent I did
associateLookup(new ProxyLookup(
ExplorerUtils.createLookup(PanelA.getExlporerManager(), map)
));
Then only the Nodes in PanelA will be spread to the PropertyView. And then to get the NodeActions to work in PanelB, I made it implement Lookup.Provider, and created it's Lookup with
lookup = ExplorerUtils.createLookup(explorerManager, map);

Check if a record is selected from a dataPointGrid

I have a dataPointGrid and I want to check if a record from it is being selected (mouse clicked on)
Data point grid above. I want to check if a folder (record) is being selected.
Is there a method that does this?
Add ListGrid#addSelectionChangedHandler() on list grid that is called when (row-based) selection changes within this grid. Note this method fires for each record for which selection is modified - so when a user clicks inside a grid this method will typically fire twice (once for the old record being deselected, and once for the new record being selected).
Look at the ListGrid#setSelectionType() as well that defines a listGrid's clickable-selection behavior (MULTIPLE, SINGLE, SIMPLE or NONE)

GWT : cell tree and initial keyboard selected node

I'm using a CellTree with the KeyboardSelectionPolicy.BOUND_TO_SELECTION.
I'd like to open the tree with a given path selected.
The code opening the child path and selecting the node is working fine when KeyboardSelectionPolicy is ENABLED/DISABLED but when BOUND_TO_SELECTION I can see that the keyboard-selected-node in the tree is never updated from : cellTree.selectionModel.setSelected( ... )
So I'm wondering if setSelected can work with BOUND_TO_SELECTION and how to do it.
See http://code.google.com/p/google-web-toolkit/issues/detail?id=6310
I suppose you could find a way to call setKeyboardSelectedRow in response to SelectionChangeEvents.