Added fancytree persist

This commit is contained in:
Deon George 2023-03-27 22:23:23 +11:00
parent 30b749dc75
commit e9cb41e5e4
2 changed files with 20 additions and 2 deletions

19
public/js/custom.js vendored
View File

@ -23,7 +23,7 @@ $(document).ready(function() {
// and pass the tree options as an argument to the fancytree() function:
$('#tree').fancytree({
clickFolderMode: 3,
extensions: ['glyph'],
extensions: ['glyph','persist'],
autoCollapse: true, // Automatically collapse all siblings, when a node is expanded.
autoScroll: true, // Automatically scroll nodes into visible area.
focusOnSelect: true, // Set focus when node is checked by a mouse click
@ -31,6 +31,23 @@ $(document).ready(function() {
preset: 'bootstrap3', // @todo look at changing this to awesome5
map: {}
},
persist: {
// Available options with their default:
cookieDelimiter: '~', // character used to join key strings
cookiePrefix: undefined, // 'fancytree-<treeId>-' by default
cookie: { // settings passed to jquery.cookie plugin
raw: false,
expires: '',
path: '',
domain: '',
secure: false
},
expandLazy: true, // true: recursively expand and load lazy nodes
expandOpts: undefined, // optional `opts` argument passed to setExpanded()
overrideSource: true, // true: cookie takes precedence over `source` data attributes.
store: 'auto', // 'cookie': use cookie, 'local': use localStore, 'session': use sessionStore
types: 'active expanded focus selected' // which status types to store
},
click: function(event,data) {
if (data.targetType == 'title') {
$.ajax({

3
resources/js/app.js vendored
View File

@ -9,8 +9,9 @@ import {createTree} from 'jquery.fancytree';
import 'jquery.fancytree/dist/modules/jquery.fancytree.edit';
import 'jquery.fancytree/dist/modules/jquery.fancytree.filter';
import 'jquery.fancytree/dist/modules/jquery.fancytree.glyph';
import 'jquery.fancytree/dist/modules/jquery.fancytree.persist';
// import 'jquery-ui/dist/jquery-ui'; // USED?
import 'jquery.fancytree/dist/skin-xp/ui.fancytree.min.css';
import 'jquery.fancytree/dist/skin-xp/ui.fancytree.css';
// Bootstrap - included in architectui
// import 'bootstrap/dist/js/bootstrap.bundle';