jstree

prevent jsTree node select

▼魔方 西西 提交于 2019-12-07 02:02:46
问题 I'm using the jsTree plugin to list folders in the file system. I need to prevent a user from changing to another node before a certain condition is met. The below code does not stop the propagation... i saw some solutions with other plugins but this is a simple task it must be possible without other plugins. $('#jstree').on('select_node.jstree', function (e) { if (!changeAllowed() { e.preventDefault(); e.stopImmediatePropagation(); } }); 回答1: Documenting for myself and posterity: you need to

jsTree disable some of the checkboxes

笑着哭i 提交于 2019-12-07 01:00:43
问题 Using jsTree (3.1.0+) with checkbox plugin is it possible to allow not all checkboxes to check - disable some of them? I found solution for old versions of jsTree here jstree disable checkbox but it didn't work on jsTree 3.1.0+ versions. Solution of hiding checkbox jsTree Hide Checkbox is working, but if I click on the folder, hidden checkbox will be checked anyway. Thanks. 回答1: Keep in mind unless you are using checkbox.tie_selection as false , selecting and checking are the same thing. So

how to get click event of row element of jstree?

孤人 提交于 2019-12-06 18:52:54
问题 Can you please tell me how how to get click event of row element of jstree ? I make a demo of jstree in my fiddle .it is made in panel .you have to press "open panel " button to check panel I want to click event of jstree element to get it id on click ? For preparation of tree I have to press "add test case button" many times and then press "open panel" button. here is my fiddle http://jsfiddle.net/ZLe2R/6/ function addMenuItemsOfTestSuit(id){ var menuid = "menu_" + id; var ref = $('#tree')

Parent node check in jstree

笑着哭i 提交于 2019-12-06 16:56:58
I have a jstree as shown below: $('#FolderTree').jstree({ 'core': { 'data': [ { 'text': 'Claim key', 'state': { 'opened': false, 'selected': false }, 'children': claimKeys }, { 'text': 'Client', 'state': { 'opened': false, 'selected': false }, 'children': clients } ] }, "plugins": ["checkbox"] }); For click event of checkbox I'm using the below jquery : $('#FolderTree').on("select_node.jstree", function (e, data) { var checkedValue = data.node.text; }); But I want to first determine if the checkbox I've clicked is parent node or child node..How can I do that?? You can use this code: $('

jsTree JSON issue [closed]

妖精的绣舞 提交于 2019-12-06 15:58:04
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I am working on some project module where i am using jstree.js plugin. I am getting following JSON via web service call: [ { "name":"Folder1",

PHP Array to jsTree

好久不见. 提交于 2019-12-06 15:02:36
I have an array of data in $key => $value pairs that I wanted to display nicely to the user. As I was trying to think of ways to do it, I came up with the though of: It'd be nice if I could just pass the JSON to the page and have a javascript tree made. Then I found jsTree , which seemed to fit my requirements perfectly. After reading the documentation, I found the JSON format which was needed to to be passed to create the tree - so I created a recursive function to transform it in to the correct array format, and then json_encode 'd it and passed it to the constructor. The problem was, json

Generate JSON from nested sets (perl, sql, jquery)

僤鯓⒐⒋嵵緔 提交于 2019-12-06 11:24:41
问题 I have content pages in the database (using nested sets) and I need to show it by jQuery jsTree plugin. It's need to return JSON with data like this: [ { data: 'node1Title', children: [ { data: 'subNode1Title', children: [...] }, { data: 'subNode2Title', children: [...] } ] }, { data: 'node2Title', children: [...] } ] What I need for do it? I can transform an array of hashes to JSON but I don't understand how to generate an array. Sample data: **'pages'table** id parent_id level lkey rkey

jsTree - Setting href attributes in Json data

北慕城南 提交于 2019-12-06 11:14:05
问题 Im trying to create a 'jsTree' treeview that gets it's data from a .Net webservice. Everything is working, except for the a-node's href attribute. Whatever I try, it always renders as '#'. As I understand from the documentation, all attributes in any data object get copied to the a-node. Below is an example of my current json object. Can anyway figure out why the href attribute isn't copied to the nodes? [ { "attributes" : { "id" : "rootnode_2", "rel" : "root2" }, "children" : [ { "attributes

jsTree - render all nodes before they are expanded?

折月煮酒 提交于 2019-12-06 11:11:18
I'm trying to display the titles of all descendants of a jsTree parent in a separate div (.childNodes) when an item is selected in the tree. My issue is that the descendants are seemingly being lazy loaded, and are only rendered in the DOM when a node is expanded, not when it is selected. Is there a way to disable this to render all nodes before the parent is expanded? This is how I'm creating the tree: container.jstree({ 'core': { 'data': { 'url': nodesContent, } }}); And this is how I'm handling the selected event: container.on("changed.jstree", function (e, data) { var i, list = "<ul>"; var

jstree prevent moving node into child nodes

大城市里の小女人 提交于 2019-12-06 07:47:35
So I've been using jstree for a while now, but still can't get a handle on it, it's pretty much a headache but well, it was decided we were gonna work with it. The data I'm using comes from HTML (no JSON involved). The issue I'm having is that I'm not sure how to set that some nodes are not folders. Every node has a class and based on that class I'm able to change it's icon but if the user tries to send any node inside these nodes that are not supposed to be folders they will be able. I need to prevent this, one way or the other but every thing I've test so far has not work at all. $("jstree")