jstree

valid json to create a jstree nodes dynamically

喜欢而已 提交于 2019-12-08 09:37:45
问题 I have a method that returns a list of roles, I want to put those roles in the jstree but I don't know how. I tried to do the following but I just don't know how to make a valid json for jstree function createNodeList() { $('#processRoleTree').jstree({ "json_data": { "ajax": { "type": "POST", "url": "/TreeLoader.aspx?Action=GetProcessRoles", "dataType": "json", "data": function (n) { return { id: n.attr ? n.attr("id") : 0} } } }, "plugins": ["json_data", "themes", "ui"] }).bind("select_node

adding rel tag/disable links in jsTree

天大地大妈咪最大 提交于 2019-12-08 07:48:19
问题 Am trying to add a rel tag to all rels that are empty for jsTree. I have managed to get this to work in jsFiddle, but when trying to apply the same code to the full tree, it does not work (that is, the rel tag still is blank/empty). I grabbed the resulting source code from my tree to use as this example, which is why am confused that the code is not working. Here is the working jsFiddle version: view here. Also, would it be possible that if the rel='disabled', to remove or disable the a href

Parent node check in jstree

…衆ロ難τιáo~ 提交于 2019-12-08 05:34:13
问题 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

Jstree set_type

倾然丶 夕夏残阳落幕 提交于 2019-12-08 05:20:39
问题 I'm binding a set_type method to my jstree instance, and then calling the set_type method when clicking a button. Here's my code: $("#treeDiv").jstree({..}).bind("set_type.jstree", function(e, data) { $.post( "./classes/jstree/_demo/server.php", { "operation" : "set_type", "id" : data.rslt.obj.attr("id").replace("node_",""), "type" : data.rslt.obj.attr("type") }, function (r) { if(!r.status) { $.jstree.rollback(data.rlbk); } } ); }); $("#settype").click(function() { $("#treeDiv").jstree("set

DOM callback for node creation

梦想与她 提交于 2019-12-08 04:05:24
问题 I want a certain callback executed each time a div satisfying a certain selector is inserted into a DOM. I've poked around the DOM events documentation, and the closest event I've found to what I need is "load", but it doesn't quite work as I hope. Ideally I want something along the lines of: $(".myclass").live("load", function(){... do stuff to $(this) ...} To give some context to what I'm doing: I have an event on a webpage which creates new forms each time some button is clicked. Modifying

Jstree set_type

a 夏天 提交于 2019-12-08 00:26:26
I'm binding a set_type method to my jstree instance, and then calling the set_type method when clicking a button. Here's my code: $("#treeDiv").jstree({..}).bind("set_type.jstree", function(e, data) { $.post( "./classes/jstree/_demo/server.php", { "operation" : "set_type", "id" : data.rslt.obj.attr("id").replace("node_",""), "type" : data.rslt.obj.attr("type") }, function (r) { if(!r.status) { $.jstree.rollback(data.rlbk); } } ); }); $("#settype").click(function() { $("#treeDiv").jstree("set_type", "block", "#node_663"); }); Type of the icon changes, but the type value dosen't changes in db.

jstree prevent moving node into child nodes

自古美人都是妖i 提交于 2019-12-07 18:57:45
问题 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

jsTree - Populate Tree Dynamically using AJAX/C#Web Method

£可爱£侵袭症+ 提交于 2019-12-07 13:09:46
问题 I have a div which I would like to fill with a jsTree: I get the "Loading" icon where the tree is meant to display, however, there would seem to be a javascript error, even though one is not thrown. I load my folder structure from an AJAX Request as follows. The Documents.aspx/GetFolders Web Method returns a List containing FolderId, ParentId & Folder Name. I have debugged the web method and it is passing the correct results to the jsTree "data" function. $.ajax({ type: "POST", url:

jsTree and AJAX > Load all data via ajax

谁都会走 提交于 2019-12-07 08:45:30
I am trying to use http://www.jstree.com as I am very happy with the demos, including the node types and the context menus. My problem is that I am not quite sure how to load the node data from within jstree using "json_data": { "ajax": { ... } }. All the documentation that I have read seems like you still need to define the parent data manually and the ajax calls are only for lazy-loading children nodes. My code is as follows: $('#file_tree').jstree({ "plugins": ["json_data", "themes", "ui", "crrm", "dnd", "search", "contextmenu"], "themes": {"theme": "apple"}, "ui": {"select_limit": 1,

.bind(“move_node.jstree”,.. -> data.rslt.obj undefined. How to get node data?

≯℡__Kan透↙ 提交于 2019-12-07 03:27:01
问题 I have a custom functionality for check_move: crrm : { move : { "check_move" : function (m) { var p = this._get_parent(m.o); if(!p) return false; if(m.cr===-1) return false; return true; } } }, This seems to work as intended. I then try to bind to the "move_node" event to update my database: .bind("move_node.jstree",function(event,data){ if(data.rslt.obj.attr("id")==""){ /* I omitted this snippet from this paste - it's really long and it basically does the same thing as below, just gets the