linjingming / sim-tree Goto Github PK
View Code? Open in Web Editor NEW一个操作简单的基于jquery的树展示插件,支持异步展示子节点
License: MIT License
一个操作简单的基于jquery的树展示插件,支持异步展示子节点
License: MIT License
I am using the simtree in salesforce lightning component and noticed one issue.
Whenever I select a node and save it, the data gets saved in back-end. However when I again launch the tree, I see the old selection on UI. Not sure what's the issue is, So I was wondering if there is a method to destroy/refresh the tree. If yes, please provide an example.
Need a way to set default selected values. So that when the tree is loaded, we can set default selection.
Currently, onClick() callback gives every selected node.
I wanted to get only the selected node.
need to change this line:
https://github.com/linjingming/sim-tree/blob/master/src/simTree.js#L342
to
$($tar[0].parentElement).data()
Maybe pass the selected node data in the first param and the list in the second?
{
"id": '1',
"pid": '',
"name": "JavaScript",
"check":"checked",
"expand":"expand"
}
This method not working
here is my code ,and all the child node is expanded.
I want to unexpand all the child node?
how to do it
``
var tree = simTree({
el: '#tree',
data: list,
check: true,
linkParent: true,
//check: true,
onClick: function (item) {
console.log(item)
},
onChange: function (item) {
console.log(item)
}
});
})
``
Hi, i have question. It is possible use bold for one element on the tree and show only one element bold?
Example in id:13:
var list = [{
"id": '1',
"pid": '',
"name": "JavaScript",
},
{
"id": '11',
"pid": '1', // parent ID
"name": "Angular"
},
{
"id": '12',
"pid": '1',
"name": "React"
},{
"id": '13',
"pid": '1',
"name": "Vuejs",
"bold": "True"
},{
"id": '14',
"pid": '1',
"name": "jQueryScript.Net"
},
{
"id": '2',
"pid": '',
"name": "HTML5"
},
{
"id": '3',
"pid": '',
"name": "CSS3",
"disabled": true
}];
Thank you
jquery-3.3.1.min.js:2 Uncaught Error: Syntax error, unrecognized expression: [data-id=VeeVee Cabs]
at Function.oe.error (jquery-3.3.1.min.js:2)
at oe.tokenize (jquery-3.3.1.min.js:2)
at Function.oe [as find] (jquery-3.3.1.min.js:2)
at w.fn.init.find (jquery-3.3.1.min.js:2)
at String.<anonymous> (simTree.js:1)
at Function.each (jquery-3.3.1.min.js:2)
at e.setSelected (simTree.js:1)
at e.doRender (simTree.js:1)
at e.render (simTree.js:1)
at e.init (simTree.js:1)
oe.error @ jquery-3.3.1.min.js:2
oe.tokenize @ jquery-3.3.1.min.js:2
oe @ jquery-3.3.1.min.js:2
find @ jquery-3.3.1.min.js:2
(anonymous) @ simTree.js:1
each @ jquery-3.3.1.min.js:2
setSelected @ simTree.js:1
doRender @ simTree.js:1
render @ simTree.js:1
init @ simTree.js:1
e @ simTree.js:1
e @ simTree.js:1
complete @ allMap.js:120
parseChunk @ papaparse.min.js:7
_chunkLoaded @ papaparse.min.js:7
(anonymous) @ papaparse.min.js:7
load (async)
_readChunk @ papaparse.min.js:7
_nextChunk @ papaparse.min.js:7
stream @ papaparse.min.js:7
parse @ papaparse.min.js:7
loadVehiclesLookup @ allMap.js:85
(anonymous) @ allMap.js:63
l @ jquery-3.3.1.min.js:2
c @ jquery-3.3.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
fire @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
ready @ jquery-3.3.1.min.js:2
_ @ jquery-3.3.1.min.js:2
Upon adding "checked": "checked"
setting to either parent or child nodes, this error happens and only the first node is checked; the error prevents from checking the other nodes.
i have below structrue
var myData = [{
"id": '1',
"pid": '',
"name": "Root",
"disabled": true
},
{
"id": '1.1',
"pid": '1', // parent ID
"name": "Level 1"
},
{
"id": '1.1.1',
"pid": '1.1', // parent ID
"name": "Level 2",
"disabled": true
},
{
"id": '1.1.1.1',
"pid": '1.1', // parent ID
"name": "Level 2"
}];
In the above structure, Level 1 can be selectable and Level 2 with id 1.1.1.1 is selectable.
If directly parent node is selected, i.e 1.1, even 1.1.1 obj is getting selected, but it should not as its disabled.
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.