85
icon: "glyphicon glyphicon-earphone",
91
icon: "glyphicon glyphicon-cloud-download",
98
icon: "glyphicon glyphicon-certificate",
101
href: "http://www.tesco.com",
102
tags: ["available", "0"],
109
'"text": "Parent 1",' +
112
'"text": "Child 1",' +
115
'"text": "Grandchild 1"' +
118
'"text": "Grandchild 2"' +
123
'"text": "Child 2"' +
128
'"text": "Parent 2"' +
131
'"text": "Parent 3"' +
134
'"text": "Parent 4"' +
137
'"text": "Parent 5"' +
141
$("#treeview1").treeview({
142
selectedBackColor: "var(--bs-primary)",
143
onhoverColor: "var(--bs-primary-bg-subtle)",
144
expandIcon: "ti ti-plus",
145
collapseIcon: "ti ti-minus",
146
nodeIcon: "ti ti-folder-filled fs-6",
150
$("#treeview2").treeview({
152
selectedBackColor: "var(--bs-primary)",
153
onhoverColor: "var(--bs-primary-bg-subtle)",
154
expandIcon: "ti ti-plus",
155
collapseIcon: "ti ti-minus",
156
nodeIcon: "ti ti-folder-filled fs-6",
160
$("#treeview3").treeview({
162
selectedBackColor: "var(--bs-primary)",
163
onhoverColor: "var(--bs-primary-bg-subtle)",
164
expandIcon: "ti ti-plus",
165
collapseIcon: "ti ti-minus",
166
nodeIcon: "ti ti-folder-filled fs-6",
170
$("#treeview4").treeview({
172
selectedBackColor: "var(--bs-primary)",
173
onhoverColor: "var(--bs-primary-bg-subtle)",
174
expandIcon: "ti ti-plus",
175
collapseIcon: "ti ti-minus",
176
nodeIcon: "ti ti-folder-filled fs-6",
180
$("#treeview5").treeview({
181
expandIcon: "ti-angle-right",
182
onhoverColor: "var(--bs-primary-bg-subtle)",
183
selectedBackColor: "var(--bs-primary)",
184
collapseIcon: "ti-angle-down",
185
nodeIcon: "fa fa-bookmark",
189
$("#treeview6").treeview({
190
selectedBackColor: "var(--bs-primary)",
191
onhoverColor: "var(--bs-primary-bg-subtle)",
192
expandIcon: "fa fa-circle",
193
collapseIcon: "fa fa-check-circle-o",
194
nodeIcon: "ti ti-user",
199
$("#treeview7").treeview({
205
$("#treeview8").treeview({
206
expandIcon: "fa fa-circle",
207
collapseIcon: "fa fa-check-circle-o",
208
nodeIcon: "ti ti-user",
211
onhoverColor: "orange",
215
highlightSelected: true,
216
selectedColor: "yellow",
217
selectedBackColor: "darkorange",
221
$("#treeview9").treeview({
222
expandIcon: "fa fa-circle",
223
collapseIcon: "fa fa-check-circle-o",
224
nodeIcon: "glyphicon glyphicon-user",
227
onhoverColor: "orange",
231
highlightSelected: true,
232
selectedColor: "yellow",
233
selectedBackColor: "darkorange",
237
$("#treeview10").treeview({
243
var $searchableTree = $("#treeview-searchable").treeview({
244
selectedBackColor: "var(--bs-primary)",
245
onhoverColor: "var(--bs-primary-bg-subtle)",
246
expandIcon: "ti ti-plus",
247
collapseIcon: "ti ti-minus",
248
nodeIcon: "ti ti-folder-filled fs-6",
252
var search = function (e) {
253
var pattern = $("#input-search").val();
255
ignoreCase: $("#chk-ignore-case").is(":checked"),
256
exactMatch: $("#chk-exact-match").is(":checked"),
257
revealResults: $("#chk-reveal-results").is(":checked"),
259
var results = $searchableTree.treeview("search", [pattern, options]);
261
var output = "<p>" + results.length + " matches found</p>";
262
$.each(results, function (index, result) {
263
output += "<p>- " + result.text + "</p>";
265
$("#search-output").html(output);
268
$("#btn-search").on("click", search);
269
$("#input-search").on("keyup", search);
271
$("#btn-clear-search").on("click", function (e) {
272
$searchableTree.treeview("clearSearch");
273
$("#input-search").val("");
274
$("#search-output").html("");
277
var initSelectableTree = function () {
278
return $("#treeview-selectable").treeview({
280
multiSelect: $("#chk-select-multi").is(":checked"),
281
onNodeSelected: function (event, node) {
282
$("#selectable-output").prepend(
283
"<p>" + node.text + " was selected</p>"
286
onNodeUnselected: function (event, node) {
287
$("#selectable-output").prepend(
288
"<p>" + node.text + " was unselected</p>"
293
var $selectableTree = initSelectableTree();
295
var findSelectableNodes = function () {
296
return $selectableTree.treeview("search", [
297
$("#input-select-node").val(),
298
{ ignoreCase: false, exactMatch: false },
301
var selectableNodes = findSelectableNodes();
303
$("#chk-select-multi:checkbox").on("change", function () {
304
console.log("multi-select change");
305
$selectableTree = initSelectableTree();
306
selectableNodes = findSelectableNodes();
310
$("#input-select-node").on("keyup", function (e) {
311
selectableNodes = findSelectableNodes();
312
$(".select-node").prop("disabled", !(selectableNodes.length >= 1));
315
$("#btn-select-node.select-node").on("click", function (e) {
316
$selectableTree.treeview("selectNode", [
318
{ silent: $("#chk-select-silent").is(":checked") },
322
$("#btn-unselect-node.select-node").on("click", function (e) {
323
$selectableTree.treeview("unselectNode", [
325
{ silent: $("#chk-select-silent").is(":checked") },
329
$("#btn-toggle-selected.select-node").on("click", function (e) {
330
$selectableTree.treeview("toggleNodeSelected", [
332
{ silent: $("#chk-select-silent").is(":checked") },
336
var $expandibleTree = $("#treeview-expandible").treeview({
338
onNodeCollapsed: function (event, node) {
339
$("#expandible-output").prepend("<p>" + node.text + " was collapsed</p>");
341
onNodeExpanded: function (event, node) {
342
$("#expandible-output").prepend("<p>" + node.text + " was expanded</p>");
346
var findExpandibleNodess = function () {
347
return $expandibleTree.treeview("search", [
348
$("#input-expand-node").val(),
349
{ ignoreCase: false, exactMatch: false },
352
var expandibleNodes = findExpandibleNodess();
355
$("#input-expand-node").on("keyup", function (e) {
356
expandibleNodes = findExpandibleNodess();
357
$(".expand-node").prop("disabled", !(expandibleNodes.length >= 1));
360
$("#btn-expand-node.expand-node").on("click", function (e) {
361
var levels = $("#select-expand-node-levels").val();
362
$expandibleTree.treeview("expandNode", [
364
{ levels: levels, silent: $("#chk-expand-silent").is(":checked") },
368
$("#btn-collapse-node.expand-node").on("click", function (e) {
369
$expandibleTree.treeview("collapseNode", [
371
{ silent: $("#chk-expand-silent").is(":checked") },
375
$("#btn-toggle-expanded.expand-node").on("click", function (e) {
376
$expandibleTree.treeview("toggleNodeExpanded", [
378
{ silent: $("#chk-expand-silent").is(":checked") },
383
$("#btn-expand-all").on("click", function (e) {
384
var levels = $("#select-expand-all-levels").val();
385
$expandibleTree.treeview("expandAll", {
387
silent: $("#chk-expand-silent").is(":checked"),
391
$("#btn-collapse-all").on("click", function (e) {
392
$expandibleTree.treeview("collapseAll", {
393
silent: $("#chk-expand-silent").is(":checked"),
397
var $checkableTree = $("#treeview-checkable").treeview({
401
onNodeChecked: function (event, node) {
402
$("#checkable-output").prepend("<p>" + node.text + " was checked</p>");
404
onNodeUnchecked: function (event, node) {
405
$("#checkable-output").prepend("<p>" + node.text + " was unchecked</p>");
409
var findCheckableNodess = function () {
410
return $checkableTree.treeview("search", [
411
$("#input-check-node").val(),
412
{ ignoreCase: false, exactMatch: false },
415
var checkableNodes = findCheckableNodess();
418
$("#input-check-node").on("keyup", function (e) {
419
checkableNodes = findCheckableNodess();
420
$(".check-node").prop("disabled", !(checkableNodes.length >= 1));
423
$("#btn-check-node.check-node").on("click", function (e) {
424
$checkableTree.treeview("checkNode", [
426
{ silent: $("#chk-check-silent").is(":checked") },
430
$("#btn-uncheck-node.check-node").on("click", function (e) {
431
$checkableTree.treeview("uncheckNode", [
433
{ silent: $("#chk-check-silent").is(":checked") },
437
$("#btn-toggle-checked.check-node").on("click", function (e) {
438
$checkableTree.treeview("toggleNodeChecked", [
440
{ silent: $("#chk-check-silent").is(":checked") },
445
$("#btn-check-all").on("click", function (e) {
446
$checkableTree.treeview("checkAll", {
447
silent: $("#chk-check-silent").is(":checked"),
451
$("#btn-uncheck-all").on("click", function (e) {
452
$checkableTree.treeview("uncheckAll", {
453
silent: $("#chk-check-silent").is(":checked"),
457
var $disabledTree = $("#treeview-disabled").treeview({
459
onNodeDisabled: function (event, node) {
460
$("#disabled-output").prepend("<p>" + node.text + " was disabled</p>");
462
onNodeEnabled: function (event, node) {
463
$("#disabled-output").prepend("<p>" + node.text + " was enabled</p>");
465
onNodeCollapsed: function (event, node) {
466
$("#disabled-output").prepend("<p>" + node.text + " was collapsed</p>");
468
onNodeUnchecked: function (event, node) {
469
$("#disabled-output").prepend("<p>" + node.text + " was unchecked</p>");
471
onNodeUnselected: function (event, node) {
472
$("#disabled-output").prepend("<p>" + node.text + " was unselected</p>");
476
var findDisabledNodes = function () {
477
return $disabledTree.treeview("search", [
478
$("#input-disable-node").val(),
479
{ ignoreCase: false, exactMatch: false },
482
var disabledNodes = findDisabledNodes();
485
$("#input-disable-node").on("keyup", function (e) {
486
disabledNodes = findDisabledNodes();
487
$(".disable-node").prop("disabled", !(disabledNodes.length >= 1));
490
$("#btn-disable-node.disable-node").on("click", function (e) {
491
$disabledTree.treeview("disableNode", [
493
{ silent: $("#chk-disable-silent").is(":checked") },
497
$("#btn-enable-node.disable-node").on("click", function (e) {
498
$disabledTree.treeview("enableNode", [
500
{ silent: $("#chk-disable-silent").is(":checked") },
504
$("#btn-toggle-disabled.disable-node").on("click", function (e) {
505
$disabledTree.treeview("toggleNodeDisabled", [
507
{ silent: $("#chk-disable-silent").is(":checked") },
512
$("#btn-disable-all").on("click", function (e) {
513
$disabledTree.treeview("disableAll", {
514
silent: $("#chk-disable-silent").is(":checked"),
518
$("#btn-enable-all").on("click", function (e) {
519
$disabledTree.treeview("enableAll", {
520
silent: $("#chk-disable-silent").is(":checked"),
524
var $tree = $("#treeview12").treeview({