Sha256: 9ba5cf48c0a96fefba7788d3c8f7af74a634f567ac57f4840a19174b915d5534
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
/* File: jstree.state.js This plugin enables state saving between reloads. */ /* Group: jstree state plugin */ (function ($) { $.jstree.plugin("state", { __construct : function () { if(typeof $.vakata.storage === "undefined") { throw "jsTree state plugin: vakata storage helper not included."; } this.get_container() .bind("__loaded.jstree", $.proxy(function (e, data) { this.restore_state(); }, this)) .bind("__ready.jstree", $.proxy(function (e, data) { this.get_container() .bind(this.get_settings(true).state.events, $.proxy(function () { this.save_state(); }, this)); }, this)); }, defaults : { key : 'jstree', // pass unique name to work with many trees events : 'select_node.jstree open_node.jstree close_node.jstree deselect_node.jstree deselect_all.jstree' }, _fn : { save_state : function () { var s = this.get_settings(true).state; $.vakata.storage.set(s.key, this.get_state()); }, restore_state : function () { var s = this.get_settings(true).state, k = $.vakata.storage.get(s.key); if(!!k) { this.set_state(k); } } } }); // include the state plugin by default // $.jstree.defaults.plugins.push("state"); })(jQuery);
Version data entries
3 entries across 3 versions & 1 rubygems