jstree

How do you format “li” and “a” DOM elements in jsTree by setting their class?

二次信任 提交于 2019-12-10 06:47:52
问题 Basically, I have a jsTree, and I need to format it's li and a DOM elements by adding custom class to each type. The documentation is not clear on how to do this and as far as I can tell, there is no way to add custom class, any formating will have to be by overriding jquery theme or by editng the jsTree source-code. I am ok with either doing it in the JSON data, or more effectively, when declaring the "types" as shown in the example here: $("#container").jstree({ "plugins" : ["themes", "json

jstree checkbox checked on load

一笑奈何 提交于 2019-12-10 01:23:24
问题 I'm fighting with jQuery jsTree plugin checkbox. Ok, I have find out how to handle events on checking or unchecking checkbox. If its useful I can paste a code: .bind("check_node.jstree", function(e, data) { if(data.rslt.obj !== undefined && data.rslt.obj.attr(\'id\') !== undefined) { jQuery.ajax({ async : false, type: "POST", dataType: "json", url: "adsmanager/adsfields/ajaxappendcategory", data: { "id" : data.rslt.obj.attr(\'id\'), "itemId" : "' . Yii::app()->getRequest()->getParam('id') . '

jsTree load children by ajax

北城以北 提交于 2019-12-09 14:47:52
问题 Code posted below loads root elements for my tree by ajax request. My tree is very large so I can't load all items at once so I need to load elements by requesting children for specific ID's. How do I load elements by ajax by clicking on node? $('#jstree_demo_div').jstree({ "plugins" : ["wholerow", "checkbox"], 'core' : { 'data' : { 'url' : function(node) { return "/" + site + "/places/api/tree/list/"; } }, } }); Part of json sample [ { "text":"zachodniopomorskie", "state":"closed", "id"

jsTree: async loading

谁说我不能喝 提交于 2019-12-09 10:23:31
问题 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

Lazy loading with jsTree

限于喜欢 提交于 2019-12-09 05:12:09
问题 I am trying to dynamically load the nodes of a jtree when they are expanded. The little documentation I found is at the end of this page. I found some solutions that create the nodes one by one with a loop like this one. I have not tried it, but looking at the documentation page I have the feeling that jstree should take care of cycling through the nodes. I found many solutions that use plugins: ["json_data"] , but the plugins documentation page doesn't mention that plugin at all. Is that an

How to change icon in jstree?

你说的曾经没有我的故事 提交于 2019-12-09 04:22:11
问题 I have the following code: $('.wpFolders.co_files').bind('select_node.jstree', function (event, data) { getFileById(data.args[0].hash.replace('#', '')); }).jstree({ 'plugins' : ['html_data','themes','ui','types'], 'ui' : { 'select_limit' : 1 }, 'core' : { 'animation' : 0 }, 'types': { 'default' : { 'icon' : { 'image' : '/admin/views/images/file.png' } } } }); I have a basic unordered list I would like to have displayed as a list of files. I'm trying to use the "types" to change the icon but I

Change icon on click jstree

橙三吉。 提交于 2019-12-08 19:53:21
问题 I have this code using jstree plugin. $(".gems-tree").on('changed.jstree' , function( event , data ){ console.log("folder clicked"); }); And it works, but now i want to change the icon from the folder to close to open, is there a way to achive this? NOTE Already try with data.node.state.opened = true just to see if the folder icon change but not. 回答1: If you need to change the icon of each selected node, the answer by Adnan Y will work (just make sure data.action is "select_node" ): $("

jstree delete_node() is not deleting

心已入冬 提交于 2019-12-08 17:44:06
问题 I've been cobbling together a function to put together a custom context menu for different nodes. Well, so far so good on getting different label to show up for clicks on folders or files, but not so much on actually deleting them. Have a look. I had to ... do a little bit of a hacky workaround because I couldn't get the node.hasClass('jstree-open') yada yada to work right, but this is generally working up to the bit that's supposed to do the deleting function customMenu(node) { //Show a

JsTree conflicts with jquery.validate

瘦欲@ 提交于 2019-12-08 16:56:50
问题 I have a Jstree populating a list of items. When I click a node a partial is loaded with ajax. Everything works fine until I include the jquery.validate script to validate my forms. <script src="/scripts/jquery.validate.js" type="text/javascript"></script> <script src="/scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript"></script> <script src="/areas/manager/scripts/jquery.jstree.min.js" type="text/javascript"></script> <script src="/areas/manager/scripts/jquery.hotkeys.js" type=

How to use jsTree events with AngularJS

断了今生、忘了曾经 提交于 2019-12-08 10:47:08
问题 I load my tree successfully using a directive in AngularJS .Now i want to add events (here select node) in my tree, so i did like this. but i can't see my alert . My code: app.directive('jstree', function() { return { restrict: 'A', scope: { jstree: '=' }, link: function(scope, element, attrs) { scope.$watch('jstree', function() { $(element).jstree({ "json_data" :{ "data":scope.jstree.data }, "themes" : { "theme" : "classic", "dots" : true, "icons" : true }, "plugins" : [ "themes", "json_data