jstree

Trying to convert XML to JSON for JsTree (Javascript/Jquery)

匆匆过客 提交于 2019-12-25 01:35:48
问题 I'm trying to create some local app. I used to learn how to dev, but havent practiced at all for 7 years. And i'm pretty rusty. I have an HTML page with an input. This input should be a XML file. The aim is to build a tree of that file using JsTree, and when i click on one of the "leaf", showing the description in another div. Well, i handled the "div" part. But i have some troubles with file reading. This is what my XML file looks like (just a sample) : <offres> <formation> <domaine

chrome extension, jstree, iframe: drag and drop

家住魔仙堡 提交于 2019-12-24 14:07:09
问题 I'm new to chrome extensions development and I'm building one that requires a side panel (not the popup), like firebug but on the right side. I'm using jsTree (with json_data) in the side panel and I want to drag elements from the webpage to the side panel. So far, to create the side panel, I've used a div appended to the body with a z-index so that it appears above the webpage, but the elements' styles in my side panel are altered because of the website's css. So I thought I could use an

Renaming a tree node dynamically outside of contextmenu in jstree

随声附和 提交于 2019-12-24 09:14:04
问题 I use the code below to successfully create a new tree node in jstree outside of contextmenu. My question is how can you dynamically RENAME the text in a tree node in a similar manner outside of the contextmenu? Is there a .jstree("rename" ....) function that can be called to accomplish this? Much appreciated! $("#RequirementsTree").jstree("create", null, "last", {"data" : "new_node_text", "state" : "open", "attr" : { "id" : "new_node_id", "name" : "requirement" }, }); I've tried the

How to get path of children when parent is selected in jstree

梦想与她 提交于 2019-12-24 06:35:55
问题 I'm trying to get the path of the parent and children nodes when the parent is selected. To get the path of the node selected I did the following: $("#jstree_demo_div").jstree({ "core" : { "data" : { "type" : "POST", "url" : "myurl.php", "data" : function (node) { return { "id" : node.id }; } }, "dataType" : "json", }, "plugins" : [ "wholerow", "checkbox", "types" ] }) .on("changed.jstree", function (e, data) { var path = $("#jstree_demo_div").jstree(true).get_path(data.node,"/"); console.log

Best way to represent list of XPaths in java

匆匆过客 提交于 2019-12-24 04:27:11
问题 I have a list of XPaths generated from a schema that I would like to represent hierarchically in Java objects. Basically I want to split each "/" from the XPath and treat them as individual objects, with no duplicates. Currently I have loaded the list into objects that have a HashMap containing the children objects. I want to do something similar but use an ArrayList instead. This is because I want to generate a JSON string without the HashMap keys. The message will be used to display a tree

Is it valid for JSON data structure to vary between a list and a boolean

江枫思渺然 提交于 2019-12-24 00:17:47
问题 The json data structure for jstree is define in https://github.com/vakata/jstree, here is an example [ { "text" : "Root node", "children" : [ "Child node 1", "Child node 2" ] } ] Notably it says The children key can be used to add children to the branch, it should be an array However later on in section Populating the tree using AJAX and lazy loading nodes it shows to use set children to false to indicate when a child has not be processed [{ "id":1,"text":"Root node","children":[ {"id":2,

jsTree drag and drop restrict folders by class

a 夏天 提交于 2019-12-23 20:13:59
问题 How can you lock the drag function on a folder by class name class="locked"? And on the same time lock other folders to be draged into this folder class="locked". I want a setup where I have both drag and drop, and contextmenu. If the node has the class name "locked" I just want to disable editing for both contextmenu and possibility to drag into this folder or drag this folder to new location. Tnx 回答1: Found a way by using the CRRM plugin combined with core documentation for .get_move(). ".o

how to listen to jsTree deselect event?

[亡魂溺海] 提交于 2019-12-23 17:25:31
问题 I am trying to listen to deselect event of JsTree like below $(document).ready(function() { var jData = [{ "data": { "attr": { "title": "A node" }, "title" : "A node" }, "children": [{ "data": { "title": "child" }, "children": [{ "data": { "title": "Grand Child" } }] }] }]; var myTree = $("#demo1").jstree({ "json_data": { "data": jData }, "plugins": ["json_data", "ui", "themeroller"] }); $(myTree).bind("select_node.jstree", function(evt, data) { console.log("selected!"); }); $(myTree).bind(

JSTree - How to force user tp only select leafs of the tree

自作多情 提交于 2019-12-23 10:06:44
问题 Within my JStree i want the user to only be able to select leafs of the tree. E.g.: Nodes that have no childs. My idea is to bind the select event and manually check whether the selected node has childs and then select/not select the node accordingly. Is there a simpler way? or is this obvious solution the only one? 回答1: You can use Types plugin .is_leaf() for checking if the selected node is a child- node (leaf) or not. Returning false in 'before'-Event will reject selecting the node. See

Jstree - precheck checkboxes

旧巷老猫 提交于 2019-12-23 04:29:39
问题 I'm using JsTree 1.0 and having trouble pre-checking checkboxes using the checkbox plugin. Here's my full code: $(".tree").bind("loaded.jstree", function (event, data) { $('.tree li.checked').each(function () { $(this).prop("checked", true); }) }).jstree({ "core" : { "animation" : 0}, "json_data" : { "ajax" : { "url" : "/admin/posts/get_taxonomy_tree", "data" : function (n) { return { id : n.attr ? n.attr("id") : 0 }; } }, "progressive_render" : true }, "checkbox" : { "real_checkboxes" : true