How do i check if the node is expanded in Kendo treeView - kendo-ui

I have a Kendo treeView. I want to collapse the node on single click (the default is on double click). To do that I need to know if the node is expanded already so I can call collapse(e.node). So, how do I check if the node has been expanded already?
Thanks a lot

You can test with $(e.node).attr("data-expanded") === "true" or kendoTreeView._expanded(e.node), however if your goal is to collapse/expand depending on the current state, you can simply call
kendoTreeView.toggle(e.node);

Related

How can I "take control" of selecting TreeView items?

If you have a TreeView in a VS Code extension, when you click on the items in it, they get selected (highlighted green, in my color theme). Click away from them and they get un-highlighted. See the below screenshot, in the file explorer view:
I'd like to "take control" of this behavior. I want to disable the highlighting that happens by default when the user clicks on these items, disable the un-highlighting that happens when they click away, and control in my extension code when the items get highlighted. I'd like to do this in my extension's custom TreeView, not an existing one.
Use the 'reveal' method of the treeview item. You can specify if it's to be 'selected' and also 'focused'.
Basically, you can change to the structure you want by forcing a refresh of the whole treeview. You probably already know that if you started making treeview extensions for vscode...
But then, right as it finishes re-rendering the tree, you 'reveal' a node, with the 'select' parameter option, to have that node as the selection in the tree. ...To have another node selected, just 'reveal' another one. (no need to force a full refresh of the treeview if it's only to have another node selected without changing the structure of the tree.)
see the 'reveal' method of the treeview here treeview API
Also see the leointeg extension on vscode for actual code example of controlling which node is selected

Expand a node and two treeviews open

I have two kendo treeview.
When I do a drag and drop an item on an other, I duplicate the item. (no node is removed on drop)
treeright.append(itemSource, itemDestinationKitem);
and it's work fine.
When I click on item (just be drop) the node opens, BUT the itemSource too !
Thx
I found a way around the problem.
By duplicating items kendo ui widget does not regenerate new uid , so to expand a mirror effect occurs.
To solve this problem I SET again the datasource of treeview with call ajax the second treeview and new uid will be affected.
To be in the same state :
I just add persistence on items to keep the state of the nodes 'expand' before loading. This kendo link help me.

d3: force directed graph: node filtering

I was going through the following post:
highlight selected node
Really a nice solution... I am a newbie to d3 and fascinated with its flexibility. I am facing problem at one point. Instead of filtering the nodes on mouseover, I want to filter it on the basis of text entered (node name or id) in a html textbox. Any idea how to achieve this??
Regards
I actually had to do something like this for a project at work. The solution I came up with was to give each node a boolean property which I called isInFilter.
Once the user enters in the text, process it and then loop through all the nodes and assign isInFilter for each node either TRUE or FALSE. Then, your condition for the node displaying (or doing whatever transition you want to do) simply becomes a check on the isInFilter property.

D3 Tree-Interactive how to detect clicks on nodes both parents and childeren

Trying to receive a callback from clicks on node. Currently the example expands a parent node if you click on it to show the children nodes. I would like to be able to click on the child node and receive a call independent from the parent node clicks. But I would need to know which child node was clicked as well. How best would this be done?
Consider using the pointer-events css attribute on the parent elements:
d3.selectAll(_parents_).style("pointer-events","none");
and give the child nodes an on click function:
d3.selectAll(_children_).on("click", _somefunction_);
Not exactly sure if this is what you were asking, otherwise I'd suggest creating a jsfiddle to describe your intentions a little better

Example of jqGrid TreeGrid that loads node children from JSON service on expand

The base problem is I have a TreeGrid that I has a significant number of nodes (over 6k) and I want to be able to load a branch when the user expands a node rather than loading all at once.
I know this is possible in jqGrid (the documentation indicates so just very poorly worded http://www.trirand.com/jqgridwiki/doku.php?id=wiki:adjacency_model ) but what I can't figure out is the precise set of jqGrid settings I need to make it do that.
I do have a functional TreeGrid that will load all records from the 'url' parameter, so the only trick I need is for it to only load the top node alone, and then load it's children when I click the ExpandRow.
Figured it out myself:
The first key is setting loaded=false in the child nodes I don't want loaded. Then I need to respond the request jqGrid sends on unloaded nodes with the right nodes.

Resources