
Security News
The Code You Didn't Write Is Still Yours to Defend
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.
orgtreeselect
Advanced tools
dist/
├── index.umd.js (UMD)
└── style.min.css (CSS, compressed)
In browser:
<script src="https://code.jquery.com/jquery-1.11.2.min.js "></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.12/jquery.validate.unobtrusive.min.js"></script>
let myTree = new OrgTreeSelect(element, (options = {}));
element
Stringoptions (optional)
Object<div id="tree"></div>
// 宣告 orgTreeSelect
let myTree = new OrgTreeSelect("#tree");
// set options
myTree.setOptions({
data: _data,
texts: {
treeTitle: "部門列表",
selectText: "請選擇",
},
showAdd: true,
showEdit: true,
showDelete: true,
showCheckbox: true,
onEdit: (node) => {
myTree.openEditDialog({
mode: 'edit',
title: "編輯",
node: node,
texts: {
id: "Id",
text: "內容",
save: "儲存",
close: "取消",
error_null: "請填寫此選項。"
},
onSave: function(dialog, formData) {
node.text = formData.text;
let isSuccess = myTree.updateNode(node);
return isSuccess;
},
});
},
// onAdd methods
onAdd: (node) => {
myTree.openEditDialog({
mode: 'add',
title: "新增",
node: node,
texts: {
id: "Id",
text: "內容",
save: "儲存",
close: "取消",
error_invalid: "此Id已重複使用",
error_null: "請填寫此選項。"
},
onSave: function(dialog, formData) {
let newNode = {
id: formData.nid,
text: formData.text,
nodes: []
}
let parent = myTree.getNode(node.id);
let isSuccess = myTree.addNode(parent, newNode);
return isSuccess;
},
});
},
// onDelete methods
onDelete: (node) => {
myTree.openDeleteDialog({
mode: 'delete',
title: "刪除",
node: node,
texts: {
id: "Id",
text: "內容",
close: "取消",
delete: "刪除"
},
onSave: function(node) {
let isSuccess = myTree.deleteNode(node);
return isSuccess;
},
});
}
});
Type: Array, an Array of node objects
Default: []
note: node object:
{id: str, text: str, nodes: [] }
至少要有id和text兩個key,子物件要放在nodes裡面。
如果傳入的data有這三項key以外的key,在建構tree時會一律放在 except的key下面。
StringnullStringnullBooleanFalseBooleanFalseBooleanFalseBooleanTrueString"#2796DB"FunctionnullFunctionnullFunctionnullSet Option to Tree
objectSelect Node by Id
StringUnselect Node by Id
StringGet Node Object by Id
ObjectGet Parent Node Object by Id
ObjectGet All Sibling Node Object by Id
ArrayGet All Child Node Object by Id
ArrayGet Selected Tags, Ingore Mother-Child Repeataion
ArrayOpen Edit/Add Dialog
options
Object{
mode: ['edit' | 'add'],
title: {String},
node: {
id: {String},
text: {String},
nodes: {Array}
},
texts: {
id: {String},
text: {String},
save: {String},
close: {String},
error_invalid: {String},
error_null: {String}
}
valid: {
rules: {
[name]: {String},
// nid_edit: "required",
// text_edit: "required"
},
messages: {
[name]: {String},
// nid_edit: newOpt.texts.error_null,
// text_edit: newOpt.texts.error_null
}
}
onSave: {function}
}
Open Delete Dialog
options
Object{
mode: ['delete'],
title: {String},
node: {
id: {String},
text: {String},
nodes: {Array}
},
texts: {
id: {String},
text: {String},
delete: {String},
close: {String}
}
onSave: {function}
}
Update Node / 編輯此node
ObjectBooleanAdd Node / 在parent node 下新增 new Node
ObjectObjectBooleanDelete Node / 刪除此node
ObjectBooleanFAQs
This is a tree select plugin.
The npm package orgtreeselect receives a total of 20 weekly downloads. As such, orgtreeselect popularity was classified as not popular.
We found that orgtreeselect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.