jstree

jsTree: async loading

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to use this jQuery plugin (jsTree) in one of my project. All the others I've found haven't been recently updated. Anyway, I am using this plugin to load a folder structure, but I would like to do this operation async. The examples I've found on their site (called async) are ridiculous. I've tried to check on the Internet but it seems that most people load the whole tree. I would like to load a branch on every single node click. I am using JSON. Thank in advance 回答1: I'm using this with jsTree in jQuery 1.4 at the moment, here's

jsTree Open a branch

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using the JQuery plugin jsTree, http://www.jstree.com/ I am able to expand the whole tree with the following method: $("#tree").jstree("open_all"); and also a specific node: $("#tree").jstree("open_node", $('#childNode')); I am having difficulty opening a branch of the tree, open branch opens it fine but does not open its parent if it has one. Has anyone successully done this with jsTree? Let me know if you need more info. Thanks Eef 回答1: You could use the binding $("#tree").bind("open_node.jstree", function (event, data) { if((data

Why doesn't jsTree open_all() work for me?

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Started playing around with jQuery and the jsTree plugin yesterday, and have it successfully loading the tree with an AJAX call to a servlet. Now, I would like to have the tree open all the nodes after loading so I added a success function to the ajax attribute. However, I cannot seem to get the open_all() method to work properly. I'm very new to working with jQuery so I'm guessing it's something simple that I'm doing wrong. Firebug isn't showing any errors which rules out the dumb error of mistyped method name. I checked the documentation

How to get all checked nodes in jstree?

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to export my nodes like this: function recursive_simplify(node){ if(node.children){ for(var i =0;i it's works fine, BUT! I need all checked nodes(checked & undetermined) My code returns only checked. Plz help. 回答1: get_all_checked: function(obj) { obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj); return obj.find(".jstree-checked, .jstree-undetermined"); }; use : var checkedNodes = $(this).jstree("get_all_checked"); 文章来源: How to get all checked nodes in jstree?

jstree disable checkbox

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am currently working on some POC using JS Tree plugin and related check box plugin. For certain nodes I need to check the check box by default and disable any further selection.I found the function to hide the check box .bind("load_node.jstree", function (e, data) { $(this).find('li[rel!=file]').find('.jstree-checkbox:first').hide(); }); instead of hiding the check box completely I want to find a way to disable check box for certain nodes 回答1: You will need to define a "disabled" type (using the types plugin) and then assign that type to

How to redraw jstree tree with new data?

ε祈祈猫儿з 提交于 2019-12-03 01:25:42
So, my question. I initialized my tree with some data: $('#tree').jstree({ 'core' : { 'data' : [ 'Simple root node', { 'id' : 'node_2', 'text' : 'Root node with options', 'state' : { 'opened' : true, 'selected' : true }, 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] } ] }); But after some actions, I want to redraw tree with new data. I try to use refresh and redraw methods from API, but it unsuccessfully. Can you give me advice, how to refresh tree (without destroy -> create new instance (it works, but it will affect the performance))? faxiubite At version 3 you can reload the tree : $('

jstree : Uncaught TypeError: Cannot read property 'children' of undefined

匿名 (未验证) 提交于 2019-12-03 01:22:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my server I am returning a JSON object in the format of jsTree : {"id":"value", "text":"value", "parent":"value"} I am getting it in my view through an Ajax call. Console.log shows me the details but jsTree gives me the error: Uncaught TypeError: Cannot read property 'children' of undefined View: $.ajax({ url: "/category", dataType: 'json', type: 'GET', success: function (res) { $.each(res, function (i, obj) { products.push([obj.id, obj.parent, obj.text]); $('#jstree_demo_div').jstree({ 'core': { 'data': [{ "id": obj.id, "parent": obj

jsTree asynchronous search - trigger load new nodes

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a nicely running implementation of jsTree running on a project of mine. The JSON data is provided by PHP/Ajax. I've run into some trouble while using the search plugin. jsTree's search plugin documentation says: so in your response you must return the path to the node (without the node itself) as ids: ["#root_node","#child_node_3"] ...so, my server side search function is returning a path to the matched node like so (yes, I'm json_encode ing it): Array ( '#1' , '#2' , '#3' , '#5' ); // to match node #10 (leaf node) at the

jsTree, JSON and MVC3 objects. How to structure data

匿名 (未验证) 提交于 2019-12-03 01:09:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have been playing with JsTree a little and MVC3. I can successfully call MVC3 methods and get back JSON to load a basic JsTree so i can do the very basics. What i don't understand is the more complicated data structure to use mostly to do wait extra data i need on nodes and also getting the tree to act on some of that data. My data is NodeText (string) - text to display ItemStatus (enum) - Used to set colors etc on tree ItemType (enum) - controls what can be dragged and dropped and onto what RelatedIDs (List ID is a struct

Change AJAX options in jstree AND reload the tree from server

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am loading XML flat tree in my jsTree using ajax, so the declaration looks like this (it works fine): $("#jstree").jstree({ "xml_data": { // "data": $xmlFlatData, "ajax": { type: "POST", async: true, "url": loc + "/AjaxReturnTree", data: '{"longnames":"'+flag+'"}', contentType: "application/json; charset=utf-8", dataType: "json", cache: false, success: function (msg) { var mm = eval('(' + msg + ')'); ; // create object to get rid of json return mm.d; }, error: function () { // TODO process error } }, "xsl": "flat", "override_ui": "true",