jstree

Jstree nodes don't work when ui plugin is used

拟墨画扇 提交于 2019-11-28 07:36:46
问题 I've found that using the ui plugin breaks the links for the tree nodes. This isn't anything new, I've found references to this problem elsewhere. The first cause was a problem with v1.6 of the jquery validation plugin. I'm not using that plugin, so that can't be the cause. I also found a good posting describing a few ways of adding the jstree-clicked class to the <a> tag. That looked promising, but when I tried it I didn't notice any difference. Here is a very simple example: <div id=

jsTree and Context Menu: modify items

岁酱吖の 提交于 2019-11-28 06:24:39
I'm using jsTree 3.0.0 and I need to modify the context in one of the following ways: Change label language for the default items, disable some default items and add new items. Rewrite all items and bind to some new items the create, rename and delete function. I tried several approaches but nothing worked. For example, this returns Uncaught TypeError: Object [object global] has no method 'create' when I click on create. "contextmenu":{ "items": function($node) { return { createItem : { "label" : "Create New Branch", "action" : function(obj) { this.create(obj); alert(obj.text())}, "_class" :

creating a new node in jstree

核能气质少年 提交于 2019-11-27 18:03:12
问题 I am creating a node by using crrm as below $("#TreeDiv").jstree("create", $("#somenode"), "inside", { "data":"new_node" }); This function is called through a wizard (i.e I am creating a node in place). So far I am successful to get a node under #somenode in that tree. The problem when the new node is created it appears focused and still editing of the node name is observed. Screenshot below - How can I disable this editing programatically 回答1: I know it's old question, but i've used a lot of

how to get the metadata of jsTree.

雨燕双飞 提交于 2019-11-27 17:58:38
问题 This is my code: $("#demo1").jstree({ "themes": { "theme": "default", "dots": true, "icons": true, "url": "static/themes/default/style.css" }, "ui" : { // this makes the node with ID node_4 selected onload "initially_select" : [ location.hash.slice(1).split('@')[1]] }, "json_data" : { "data" : [ { "data" : "A node", "attr" : { "id" : "1" ,time:1321}, "callback":function(){alert('sss')}, "children" : [ { "data" : "ttt node", "children" : [ "Child 1", "Child 2" ] } ] }, { "attr" : { "id" : "2"

Configuring jstree right-click contextmenu for different node types

耗尽温柔 提交于 2019-11-27 17:02:48
I've seen an example somewhere online showing how to customise the appearance of jstree's right-click context menu (using contextmenu plugin). For example, allow my users to delete "documents" but not "folders" (by hiding the "delete" option from the context menu for folders). Now I can't find that example. Can anyone point me in the right direction? The official documentation didn't really help. Edit: Since I want the default context menu with only one or two minor changes, I'd prefer to not recreate the whole menu (though of course I will if it's the only way). What I'd like to do is

jsTree : How to get IDs of selected nodes to root node in jsTree?

血红的双手。 提交于 2019-11-27 14:51:20
问题 How to get IDs of selected nodes to root node in jsTree? Assume C is selected node then How can I get All parent IDs of C. A B C +C1 +c2 Following code will return only immediate parent ID: If I selected C then I get only B .bind("select_node.jstree", function (event, data) { //`data.rslt.obj` is the jquery extended node that was clicked alert("Selected node = "+ data.rslt.obj.attr("id")); alert("Parent of Selected node = "+ data.inst._get_parent(data.rslt.obj).attr("id")) }); Output:

get checked values for jsTree - submit with form post

空扰寡人 提交于 2019-11-27 12:31:10
问题 I'm using the jsTree jQuery plugin with the checkbox theme. Does anyone know how to get the selected values with a form post? Thank you! 回答1: Have you got your answer ? If not, here is one that appears in the jstree google groups function submitMe(){ var checked_ids = []; $("#server_tree").jstree("get_checked",null,true).each (function () { checked_ids.push(this.id); }); doStuff(checked_ids); 回答2: In the last version (3.0), the API was changed. If you need just array of selected IDs (like in

jstree的基本使用例子

六月ゝ 毕业季﹏ 提交于 2019-11-27 09:49:05
jstree的基本使用例子 var menu = (function() { var _menu = {data:{}, initMenu : function() { $.jstree.defaults.core.themes.variant = "large"; $.jstree.defaults.core.themes.responsive = true; $.jstree.defaults.sort=function(a,b){ return this.get_node(a).original.order > this.get_node(b).original.order ? 1 : -1; } var jsTree = $('#tree_1').jstree( { 'core' : { 'data' :{ 'url':$.hr_contextUrl()+"menu/list", 'data':function(node){ return node; } } }, 'plugins':['contextmenu','sort'], "contextmenu":{ "items":{ "create":null, "rename":null, "remove":null, "ccp":null, "新建菜单":{ "label":"新建菜单", "action"

jsTree unable to load root nodes from AJAX call

半城伤御伤魂 提交于 2019-11-27 08:26:16
问题 I am not able to load the initial root nodes using jsTree below: the data is on a server and has to be 'bought in' via AJAX for each node selected. I also want to use a checkbox and get value of all parent nodes of a selected node. main issue right now is: I am not able to list the root nodes.... //jsTree $('#testTree').jstree({ 'core' : { 'data' : { 'url' : function (node) { return node.id === '#' ? '/cgi-bin/test.pl' //url for root nodes '/cgi-bin/test.pl?nodes-in-selected-heirarchy'; //url

jsTree and Context Menu: modify items

时光总嘲笑我的痴心妄想 提交于 2019-11-27 01:19:29
问题 I'm using jsTree 3.0.0 and I need to modify the context in one of the following ways: Change label language for the default items, disable some default items and add new items. Rewrite all items and bind to some new items the create, rename and delete function. I tried several approaches but nothing worked. For example, this returns Uncaught TypeError: Object [object global] has no method 'create' when I click on create. "contextmenu":{ "items": function($node) { return { createItem : {