m-thalmann / treejs Goto Github PK
View Code? Open in Web Editor NEWA simple JavaScript library, to display a TreeView like in the windows filebrowser
Home Page: https://prod.thalmann.it/treejs/demo.html
License: MIT License
A simple JavaScript library, to display a TreeView like in the windows filebrowser
Home Page: https://prod.thalmann.it/treejs/demo.html
License: MIT License
There is any problem using this script with a container inside a bootstrap modal? Because i am trying to make it working, but I cannot.
Thanks and great work!
Assigning a callback to a "select", or "click" events makes the callback function fire for all nodes during initial load, then doesn't react to clicks/selection.
What am I doing wrong?
child = new TreeNode(value);
child.on('select', console.log(value));
a.addChild(child);
The HTML tags are not escaped in the node's name.
If it is intended, an option to turn on encoding should be added.
If it is not intended and encoding will be added, an option to turn it off should be added too.
Hi
Awesome work..
Q1. Is it possible to search for a node by a path e.g. a\b\c?
Q2. Is it possible to feed this a JSON schema that has parent & child relationships?
Thanks.
Could you please add an option to a TreeNode to make it explicitly a folder, not a leaf/file? If it is an empty folder, it will be displayed as a leaf/file instead of a folder that is empty.
var node = new TreeNode("parent")
var childNode = new TreeNode("child Node")
childNode.getRoot()
I am trying to get the parent node using this method but getting a node instead.
I want to get the value of parent node.
Please help.
Do you plan to make your code available on npm?
I'm trying to modify your example in 'issue #8' with the aim of producing a string containing the whole path from root to the clicked node, hence for my modification I was hoping to get the string "root - 1 - 1.1".
The only difference between your test in 'issue #8' and mine is within your "on/select" function (see mine below). However I don't manage to get it to run properly. The fist alert, only showing the selected folder ("1.1"), pops up alright. But the rest of the alert's are ignored, so I'm surely doing something wrong (no exeption's are thrown though). After "countless" trial/errors I'm running out of ideas what to try next. Do you have the possibility to point me in the good direction?
n11.on('select', function (e) {
alert(e);
var mySelNode = tree.getSelectedNodes();
alert("1");
path.setPath(root, mySelNode);
alert("2");
path.getPath();
alert("3");
alert(path.toString());
})
In the constructor of TreeNode, the check for the type of userObject (is it string or an object with a toString function) is wrong.
Currently if the userObject is a string, it checks if it has a toString function (it does).
If the userObject is not a string, it errors, without checking the toString function.
It should look like this:
if(typeof userObject !== "string" && typeof userObject.toString !== "function")
Could you please add the option to the TreeView to hide the root element?
Sometimes displaying a single root element will just create unnecessary indentation. It would look better if all the children of the root are on the first level, not the second level under the root element.
This should be an option, so it can be turned on on demand.
can we make tree from hash JSON ? like :
{name: "root", childs: [{name: "node1"}, {name: "node2", childs: [...]}]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.