Sha256: ada5bfc53dbfa5b98b5d75d3f227cdebf3ca0428edeb40f13d8642ade3b80e3d

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

/**
 * ### Conditionalselect plugin
 *
 * This plugin allows defining a callback to allow or deny node selection by user input (activate node method).
 */
/*globals jQuery, define, exports, require, document */
(function (factory) {
	"use strict";
	if (typeof define === 'function' && define.amd) {
		define('jstree.conditionalselect', ['jquery','jstree'], factory);
	}
	else if(typeof exports === 'object') {
		factory(require('jquery'), require('jstree'));
	}
	else {
		factory(jQuery, jQuery.jstree);
	}
}(function ($, jstree, undefined) {
	"use strict";

	if($.jstree.plugins.conditionalselect) { return; }

	/**
	 * a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`.
	 * @name $.jstree.defaults.checkbox.visible
	 * @plugin checkbox
	 */
	$.jstree.defaults.conditionalselect = function () { return true; };
	$.jstree.plugins.conditionalselect = function (options, parent) {
		// own function
		this.activate_node = function (obj, e) {
			if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) {
				return parent.activate_node.call(this, obj, e);
			}
		};
	};

}));

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sequenceserver-3.1.3 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-3.1.2 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-3.1.1 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-3.1.0 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-3.0.1 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-3.0 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-2.2.0 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-2.1.0 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js
sequenceserver-2.0.0 public/vendor/github/vakata/jstree@3.3.8/src/jstree.conditionalselect.js