var _b = document.createElement('B'); _b.className = 'jstree-icon jstree-inputbox';
$.jstree.defaults.inputbox = { /** * a boolean indicating if input boxes should be visible. Defaults to `true`. * @name $.jstree.defaults.inputbox.visible * @plugin inputbox */ visible : true, }; $.jstree.plugins.inputbox = function (options, parent) { this.bind = function () { parent.bind.call(this); this.element .on("init.jstree", ".jstree-anchor", $.proxy(function () { this._data.inputbox.visible = this.settings.inputbox.visible; }, this)) .on("loading.jstree", $.proxy(function () { // this[ this._data.inputbox.visible ? 'show_inputboxes' : 'hide_inputboxes' ]();
}, this)) .on("click.jstree", $.proxy(function (e) { // this[ this._data.inputbox.visible ? 'show_inputboxes' : 'hide_inputboxes' ](); // this.element.addClass('jstree-inputbox'); var obj = this.get_node(e.target); this.edit(obj); }, this)); }; this.teardown = function () { if(this.settings.inputbox) { this.element.find(".jstree-inputbox").remove(); } parent.teardown.call(this); }; /** * show the node inputbox icons * @name show_inputboxes() * @plugin inputbox */ this.show_inputboxes = function () { this._data.core.themes.inputboxes = true; this.get_container_ul().removeClass("jstree-no-inputboxes"); }; /** * hide the node inputbox icons * @name hide_inputboxes() * @plugin inputbox */ this.hide_inputboxes = function () { this._data.core.themes.inputboxes = false; this.get_container_ul().addClass("jstree-no-inputboxes"); }; };In this.element.on (some event.....) {
var obj = this.get_node('#');
values[obj.children_d[i]]=$("input#"+obj.children_d[i]).val();
}
// below I set the id of the input box via tmp
this.redraw_node = function(obj, deep, callback) { obj = parent.redraw_node.call(this, obj, deep, callback); if(obj) { obj.insertBefore(tmp, obj.childNodes[1]); } return obj; };(function ($, undefined) {
"use strict";
$.jstree.plugins.selector = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this.element.on("change", ".jstree-selector", $.proxy(function (e) {
var node = this.get_node($(e.target));
$(e.target).trigger( "change_selector.jstree", [node, $(e.target)]);
}, this));
};
this.teardown = function () {
if(this.settings.questionmark) {
this.element.find(".jstree-selector").remove();
}
parent.teardown.call(this);
};
this.redraw_node = function(obj, deep, callback) {
var node = this.get_node(obj);
var param = this.settings.selector.param;
var array = this.settings.selector.options;
var select = document.createElement("SELECT");
select.id = "selector";
select.className = "jstree-selector";
select.setAttribute("style", "appearance: button;-moz-appearance: button;" +
" -webkit-appearance: button;height: auto;width:100px;position:relative;" +
"color:inherit;text-decoration:none;display:inline-block;" +
"vertical-align:top;white-space:nowrap;margin-left:10px;");
obj = parent.redraw_node.call(this, obj, deep, callback);
if(node.parent === '#') {
for (var i = 0; i < array.length; i++) {
var option = document.createElement("OPTION");
option.value = array[i].value;
option.text = array[i].text;
if(node.data != null && array[i].value == node.data[param]){
option.setAttribute("selected", true)
}
select.appendChild(option);
}
var tmp = select.cloneNode(true);
obj.insertBefore(tmp, obj.childNodes[3]);
array = [];
}
return obj;
};
};
})(jQuery);