jstree

how to deny delete/rename/move root(or other) node(s) in jsTree?

偶尔善良 提交于 2019-12-11 05:26:49
问题 for example: [{ "data": "reference", "attr": { "id": "0" }, "state": "open", "children": [ [{ "data": "one", "attr": { "id": "1" }, "state": "closed" }, { "data": "two", "attr": { "id": "2" } }] ] }, { "data": "recycle bin", "attr": { "id": "bin" }, "state": "closed", "children": [] }] i need to deny delete/move/rename "reference" & "recycle bin" nodes with "dnd", "crrm" and "context menu" plugins 回答1: For avoiding moves using the crrm plugin you could do: "crrm": { "move": { "check_move":

jstree - node selection based on current navigated url

南楼画角 提交于 2019-12-11 05:03:30
问题 Today I'm using the built-in cookies of the jsTree in order to preserve user navigations in the tree. on node click in the tree the user is redirected to the corresponding page in my site and the clicked node is selected/highlighted thanks to the jsTree cookies integration. Now, I would like to to select/highlight nodes in the tree also based on a navigation among the web site, i.e., a link in the site might also be a node in the tree, for example, a grid of rows that also appears in the tree

change color of jstree node

我的未来我决定 提交于 2019-12-11 04:04:26
问题 Has anybody ever tried to change the color of jstree particular node using types plugin? And also I want to avoid click event on that node. I need to do this to prevent users from selecting the same node. 回答1: Example on how to change color of any node being clicked: $(function() // document ready { $("#my_jstree_instance a").live("click", function(e) { nodeid = $(this).parent().attr("id").split("_")[1]; $("#node_"+nodeid+" >a").css("color","red"); } } 来源: https://stackoverflow.com/questions

How do I get a jstree node to display long, possibly multiline content?

放肆的年华 提交于 2019-12-11 03:11:33
问题 When using the jsTree plugin, I need to have a node which displays its full content. Right now, the nodes only display approximately one line of text each. How can I get the nodes in a jsTree to display all of the text in the node without truncating the node's content? 回答1: The following CSS code will do the trick: .jstree-default a { white-space:normal !important; height: auto; } .jstree-anchor { height: auto !important; } .jstree-default li > ins { vertical-align:top; } .jstree-leaf {

Loading Json as variable into jsTree

对着背影说爱祢 提交于 2019-12-11 02:38:32
问题 I am using jstree with Json. My problem is that I can provide the Json directly into jsTree data, but when I pass it as a variable it will print the entire Json string as the title of one node. below is nodes.json { "id": "ajson1", "parent": "#", "text": "Simple root node" }, { "id": "ajson2", "parent": "#", "text": "Root node 2" }, { "id": "ajson3", "parent": "ajson2", "text": "Child 1" }, { "id": "ajson4", "parent": "ajson2", "text": "Child 2" }, this code below works request = $.getJSON(

CSS Layout: 2 column fixed-fluid (again)

谁说胖子不能爱 提交于 2019-12-11 02:29:11
问题 I'm trying to setup a 2-column layout where the left area is fixed and the main content is fluid. I've seen several answers on here, which tend to work. However, there is some odd behavior when I use a "jsTree" in my "left" area and jQuery UI tabs in the main/content area. html <div id="main"> <div id="left"> <div id="tree"> </div> </div> <div id="right"> <ul> <li><a href="#a">A</a></li> <li><a href="#b">B</a></li> <li><a href="#c">C</a></li> </ul> <div id="a"> <h3>A is here</h3> </div> <div

How to get selected node's text in jstree

依然范特西╮ 提交于 2019-12-11 02:24:27
问题 I have a jstree like shown below and have the code in my script $("#jstree").click(function (e) { var node = $("#jstree").jstree('get_selected'); $('#resultText').html(node); }); What i need is if i am selecting book, title, price i need to display output as book-title-price . By using above code i can get id s ie. 1-1_1-1_2 of my selected nodes but how can i get text s of the selected nodes in the above format? COMPLETE CODE for jstree integration. @model List<XMLNodeSearch.Models

Can I use jsTree preloaded with JSON data and also use Ajax

孤街醉人 提交于 2019-12-11 02:22:33
问题 I have jsTree working with JSON data: the JSON data represents the server's file system, and the user can select a folder from the tree, which is then added to the folder input field). I don't want the page to load without the top three levels of the file system provided. However, I don't parse the whole file system because that would take too long. Can I pre-populate jsTree with JSON data and use Ajax when the user opens nodes further down the tree which were not pre-populated, or do I have

jsTree show/hide nodes

随声附和 提交于 2019-12-10 22:25:13
问题 I'm working with jstree and I would like to know how to hide/show nodes if possible. I gave the list items a "cat" id to select them with jquery but this doesn't work. Here's the code. html: <div class="resultsContent"> <div class="demo" id="demo_1"> <ul> {% for ipc in ipcs %} {% ifequal ipc.back_list 1 %} </ul></li> {% endifequal %} {% ifequal ipc.kind "c" %} <li id="{{ ipc.symbol }} cat" rel="node-type"> {% else %} <li id="{{ ipc.symbol }} cat" rel="node-type"> {% endifequal %} {% endfor %}

JSTree check is selected nodes are leaf or make only leaves selectable

左心房为你撑大大i 提交于 2019-12-10 17:40:53
问题 I created a jstree as follows $('#js-tree').jstree({ 'core' : { 'data' : { 'url' : "${pageContext.request.contextPath}/makeTree", "plugins" : [ "types", "search"], 'data' : function (node) { return { 'id' : node.id }; } } } }); I want to check if a selected node is a leaf node while submitting the information - var selectedLeaves = $("#js-tree").jstree("get_selected"); But this gives me array of id's only. How do I either use is_leaf method to filter our only leaf nodes from the selected